src/winsup/utils ChangeLog setfacl.c

Corinna Vinschen
Mon Dec 13 16:43:00 GMT 2010

On Dec 13 09:10, Eric Blake wrote:
> On 12/11/2010 01:47 PM, XXXXXXXXXXXXXXXXXX wrote:


> > CVSROOT:	/cvs/src
> > Module name:	src
> > Changes by:	XXXXXXXXXXXXXXXXXXXXXX	2010-12-11 20:47:01

Bzz again.

> > 
> > Modified files:
> > 	winsup/utils   : ChangeLog setfacl.c 
> > 
> > Log message:
> > 	* setfacl.c (strchrnul): New function.
> Should we implement strchrnul in newlib instead?  Your implementation
> works, but the naive byte-wise loop is almost an order of magnitude
> slower than searching a word at a time using some of the same tricks as
> strlen().  And several GNU programs, such as tar, would use native
> strchrnul() if it existed (right now, they get it from gnulib).

In case of setfacl the strings are so short that it doesn't matter.

As for newlib, there's not only a file libc/string/strchr.c, but also
assembler implementations for various targets in libc/machine.  In
theory it would be nice to implement strchrnul in C and for all targets
instead, and then implement strchr like this:

  strchr (a, b) {
    ret = strchrnul (a, b)
    return *ret || !b ? ret : NULL;

But maybe a generic, independent C implementation copied from
libc/string/strchr.c would be sufficent for a start...


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-developers mailing list