[darcs-devel] darcs patch: Replace my_memrchr() with strrchr().

David Roundy droundy at abridgegame.org
Tue Apr 19 04:11:32 PDT 2005


On Mon, Apr 18, 2005 at 10:07:38PM +0100, Ralph Corderoy wrote:
> > On Mon, Apr 18, 2005 at 09:05:57AM -0400, Ralph Corderoy wrote:
> > > Sun Apr 17 23:05:34 BST 2005  Ralph Corderoy <ralph at inputplus.co.uk>
> > >   * Replace my_memrchr() with strrchr().
> > >   Given it's only ever called on a string, not an arbitrary lump of
> > >   memory, my_memrchr() can be replaced with strrchr() which is in
> > >   <string.h>.
> > 
> > I don't think we want to require that this always be called with a
> > string, so I'd rather keep the my_memrchr.  If my_memrchr is slower
> > than an optimized version, we could easily add configure checks and
> > use the real thing if it's available.
> 
> Given it's static, there's just one call to it, which is a C string
> containing a pathname so that's unlikely to change, and it isn't a hard
> function to write I'd still vote for scrapping it now.  It's one less
> routine for the reader to parse, and it makes the code that uses it more
> familiar too.

Oh, I see, sorry.  I had been sloppy in reading the patch (I was at
work...), and for some reason thought we were in fpstring.  You're right
that strrchr would be perfectly fine here.
-- 
David Roundy
http://www.darcs.net




More information about the darcs-devel mailing list