Verify callback is run in either side.
[gnutls.git] / gl / strings.in.h
blob7ed88e9a73477a9b7118f753b74e6eacc953e59d
1 /* A substitute <strings.h>.
3 Copyright (C) 2007-2012 Free Software Foundation, Inc.
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 3, or (at your option)
8 any later version.
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
15 You should have received a copy of the GNU General Public License
16 along with this program; if not, see <http://www.gnu.org/licenses/>. */
18 #ifndef _@GUARD_PREFIX@_STRINGS_H
20 #if __GNUC__ >= 3
21 @PRAGMA_SYSTEM_HEADER@
22 #endif
23 @PRAGMA_COLUMNS@
25 /* Minix 3.1.8 has a bug: <sys/types.h> must be included before <strings.h>.
26 But avoid namespace pollution on glibc systems. */
27 #if defined __minix && !defined __GLIBC__
28 # include <sys/types.h>
29 #endif
31 /* The include_next requires a split double-inclusion guard. */
32 #if @HAVE_STRINGS_H@
33 # @INCLUDE_NEXT@ @NEXT_STRINGS_H@
34 #endif
36 #ifndef _@GUARD_PREFIX@_STRINGS_H
37 #define _@GUARD_PREFIX@_STRINGS_H
39 #if ! @HAVE_DECL_STRNCASECMP@
40 /* Get size_t. */
41 # include <stddef.h>
42 #endif
45 /* The definitions of _GL_FUNCDECL_RPL etc. are copied here. */
47 /* The definition of _GL_ARG_NONNULL is copied here. */
49 /* The definition of _GL_WARN_ON_USE is copied here. */
51 #ifdef __cplusplus
52 extern "C" {
53 #endif
56 /* Find the index of the least-significant set bit. */
57 #if @GNULIB_FFS@
58 # if !@HAVE_FFS@
59 _GL_FUNCDECL_SYS (ffs, int, (int i));
60 # endif
61 _GL_CXXALIAS_SYS (ffs, int, (int i));
62 _GL_CXXALIASWARN (ffs);
63 #elif defined GNULIB_POSIXCHECK
64 # undef ffs
65 # if HAVE_RAW_DECL_FFS
66 _GL_WARN_ON_USE (ffs, "ffs is not portable - use the ffs module");
67 # endif
68 #endif
70 /* Compare strings S1 and S2, ignoring case, returning less than, equal to or
71 greater than zero if S1 is lexicographically less than, equal to or greater
72 than S2.
73 Note: This function does not work in multibyte locales. */
74 #if ! @HAVE_STRCASECMP@
75 extern int strcasecmp (char const *s1, char const *s2)
76 _GL_ARG_NONNULL ((1, 2));
77 #endif
78 #if defined GNULIB_POSIXCHECK
79 /* strcasecmp() does not work with multibyte strings:
80 POSIX says that it operates on "strings", and "string" in POSIX is defined
81 as a sequence of bytes, not of characters. */
82 # undef strcasecmp
83 # if HAVE_RAW_DECL_STRCASECMP
84 _GL_WARN_ON_USE (strcasecmp, "strcasecmp cannot work correctly on character "
85 "strings in multibyte locales - "
86 "use mbscasecmp if you care about "
87 "internationalization, or use c_strcasecmp , "
88 "gnulib module c-strcase) if you want a locale "
89 "independent function");
90 # endif
91 #endif
93 /* Compare no more than N bytes of strings S1 and S2, ignoring case,
94 returning less than, equal to or greater than zero if S1 is
95 lexicographically less than, equal to or greater than S2.
96 Note: This function cannot work correctly in multibyte locales. */
97 #if ! @HAVE_DECL_STRNCASECMP@
98 extern int strncasecmp (char const *s1, char const *s2, size_t n)
99 _GL_ARG_NONNULL ((1, 2));
100 #endif
101 #if defined GNULIB_POSIXCHECK
102 /* strncasecmp() does not work with multibyte strings:
103 POSIX says that it operates on "strings", and "string" in POSIX is defined
104 as a sequence of bytes, not of characters. */
105 # undef strncasecmp
106 # if HAVE_RAW_DECL_STRNCASECMP
107 _GL_WARN_ON_USE (strncasecmp, "strncasecmp cannot work correctly on character "
108 "strings in multibyte locales - "
109 "use mbsncasecmp or mbspcasecmp if you care about "
110 "internationalization, or use c_strncasecmp , "
111 "gnulib module c-strcase) if you want a locale "
112 "independent function");
113 # endif
114 #endif
117 #ifdef __cplusplus
119 #endif
121 #endif /* _@GUARD_PREFIX@_STRING_H */
122 #endif /* _@GUARD_PREFIX@_STRING_H */