X-Git-Url: http://sjero.net/git/?p=wget;a=blobdiff_plain;f=lib%2Fstring.in.h;h=079f2df5cf1b339b6506a18175e3f30bbae179ee;hp=5c7597cefb1e41b69c21723e001736e19fbe8933;hb=2456d9bc547aacc8ad387f441e81455cd9301fe7;hpb=992e3169e28a23b6899433768dcd4302553b31c3 diff --git a/lib/string.in.h b/lib/string.in.h index 5c7597ce..079f2df5 100644 --- a/lib/string.in.h +++ b/lib/string.in.h @@ -1,6 +1,6 @@ /* A GNU-like . - Copyright (C) 1995-1996, 2001-2008 Free Software Foundation, Inc. + Copyright (C) 1995-1996, 2001-2009 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -18,12 +18,18 @@ #ifndef _GL_STRING_H +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif + /* The include_next requires a split double-inclusion guard. */ #@INCLUDE_NEXT@ @NEXT_STRING_H@ #ifndef _GL_STRING_H #define _GL_STRING_H +/* NetBSD 5.0 mis-defines NULL. */ +#include #ifndef __attribute__ /* This feature is available in gcc versions 2.5 and later. */ @@ -45,6 +51,21 @@ extern "C" { #endif +/* Return the first instance of C within N bytes of S, or NULL. */ +#if @GNULIB_MEMCHR@ +# if @REPLACE_MEMCHR@ +# define memchr rpl_memchr +extern void *memchr (void const *__s, int __c, size_t __n) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef memchr +# define memchr(s,c,n) \ + (GL_LINK_WARNING ("memchr has platform-specific bugs - " \ + "use gnulib module memchr for portability" ), \ + memchr (s, c, n)) +#endif + /* Return the first occurrence of NEEDLE in HAYSTACK. */ #if @GNULIB_MEMMEM@ # if @REPLACE_MEMMEM@ @@ -93,6 +114,22 @@ extern void *memrchr (void const *, int, size_t) memrchr (a, b, c)) #endif +/* Find the first occurrence of C in S. More efficient than + memchr(S,C,N), at the expense of undefined behavior if C does not + occur within N bytes. */ +#if @GNULIB_RAWMEMCHR@ +# if ! @HAVE_RAWMEMCHR@ +extern void *rawmemchr (void const *__s, int __c_in) + __attribute__ ((__pure__)); +# endif +#elif defined GNULIB_POSIXCHECK +# undef rawmemchr +# define rawmemchr(a,b) \ + (GL_LINK_WARNING ("rawmemchr is unportable - " \ + "use gnulib module rawmemchr for portability"), \ + rawmemchr (a, b)) +#endif + /* Copy SRC to DST, returning the address of the terminating '\0' in DST. */ #if @GNULIB_STPCPY@ # if ! @HAVE_STPCPY@ @@ -149,7 +186,11 @@ extern char *strchrnul (char const *__s, int __c_in) /* Duplicate S, returning an identical malloc'd string. */ #if @GNULIB_STRDUP@ -# if ! @HAVE_DECL_STRDUP@ && ! defined strdup +# if @REPLACE_STRDUP@ +# undef strdup +# define strdup rpl_strdup +# endif +# if !(@HAVE_DECL_STRDUP@ || defined strdup) || @REPLACE_STRDUP@ extern char *strdup (char const *__s); # endif #elif defined GNULIB_POSIXCHECK @@ -560,6 +601,18 @@ extern char *strsignal (int __sig); strsignal (a)) #endif +#if @GNULIB_STRVERSCMP@ +# if !@HAVE_STRVERSCMP@ +extern int strverscmp (const char *, const char *); +# endif +#elif defined GNULIB_POSIXCHECK +# undef strverscmp +# define strverscmp(a, b) \ + (GL_LINK_WARNING ("strverscmp is unportable - " \ + "use gnulib module strverscmp for portability"), \ + strverscmp (a, b)) +#endif + #ifdef __cplusplus }