This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: src/winsup/utils ChangeLog setfacl.c


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

Bzz.

> > 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

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]