Mercurial > gnulib
comparison lib/string.in.h @ 9999:5f559abfabef
Add rawmemchr module, matching glibc.
* modules/string (Makefile.am): New indicator.
* m4/string_h.m4 (gl_HEADER_STRING_H_DEFAULTS): Set it.
* lib/string.in.h (rawmemchr): Declare when appropriate.
* modules/rawmemchr: New file.
* m4/rawmemchr.m4: Likewise.
* lib/rawmemchr.c: Likewise.
* modules/rawmemchr-tests: Likewise.
* tests/test-rawmemchr.c: Likewise.
* doc/glibc-functions/rawmemchr.texi (rawmemchr): Document
module.
* modules/strchrnul (Depends-on): Add rawmemchr.
* lib/strchrnul.c (strchrnul): Optimize a corner case.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Mon, 28 Apr 2008 17:08:43 -0600 |
parents | 69d9307c0aa0 |
children | 8d80c477e0ad |
comparison
equal
deleted
inserted
replaced
9998:3362dfd48604 | 9999:5f559abfabef |
---|---|
89 # undef memrchr | 89 # undef memrchr |
90 # define memrchr(a,b,c) \ | 90 # define memrchr(a,b,c) \ |
91 (GL_LINK_WARNING ("memrchr is unportable - " \ | 91 (GL_LINK_WARNING ("memrchr is unportable - " \ |
92 "use gnulib module memrchr for portability"), \ | 92 "use gnulib module memrchr for portability"), \ |
93 memrchr (a, b, c)) | 93 memrchr (a, b, c)) |
94 #endif | |
95 | |
96 /* Find the first occurrence of C in S. More efficient than | |
97 memchr(S,C,N), at the expense of undefined behavior if C does not | |
98 occur within N bytes. */ | |
99 #if @GNULIB_RAWMEMCHR@ | |
100 # if ! @HAVE_RAWMEMCHR@ | |
101 extern void *rawmemchr (void const *__s, int __c_in) | |
102 __attribute__ ((__pure__)); | |
103 # endif | |
104 #elif defined GNULIB_POSIXCHECK | |
105 # undef rawmemchr | |
106 # define rawmemchr(a,b) \ | |
107 (GL_LINK_WARNING ("rawmemchr is unportable - " \ | |
108 "use gnulib module rawmemchr for portability"), \ | |
109 rawmemchr (a, b)) | |
94 #endif | 110 #endif |
95 | 111 |
96 /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ | 112 /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ |
97 #if @GNULIB_STPCPY@ | 113 #if @GNULIB_STPCPY@ |
98 # if ! @HAVE_STPCPY@ | 114 # if ! @HAVE_STPCPY@ |