Alan Coopersmith <alan.coopersm...@oracle.com> wrote: > James Carlson wrote: > > On 5/1/10 11:31 AM, Joerg Schilling wrote: > >> OK, let's see.... here is the code: > > [...] > >> #include <schily/standard.h> > >> #include <schily/unistd.h> > >> #include <schily/schily.h> > >> > >> #ifndef HAVE_STRNLEN > >> > >> EXPORT size_t > >> strnlen(s, len) > >> register const char *s; > >> register size_t len; > > > > The above will need to be rewritten to conform with the style used in > > the current OpenSolaris libc. That means: > > Except that it's not needed for libc, which already has strnlen: > http://src.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/lib/libc/port/gen/strnlen.c
This code is based on memchr() and in case that memchr() does any speed optimization via extended word lengths, the code does not follow the POSIX standard as POSIX requires not to touch any data behind "len". Jörg -- EMail:jo...@schily.isdn.cs.tu-berlin.de (home) Jörg Schilling D-13353 Berlin j...@cs.tu-berlin.de (uni) joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/ URL: http://cdrecord.berlios.de/private/ ftp://ftp.berlios.de/pub/schily _______________________________________________ opensolaris-code mailing list opensolaris-code@opensolaris.org http://mail.opensolaris.org/mailman/listinfo/opensolaris-code