xref: /dflybsd-src/contrib/gdb-7/gdb/gnulib/import/strnlen1.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
1*ef5ccd6cSJohn Marino /* Find the length of STRING + 1, but scan at most MAXLEN bytes.
2*ef5ccd6cSJohn Marino    Copyright (C) 2005, 2009-2012 Free Software Foundation, Inc.
3*ef5ccd6cSJohn Marino 
4*ef5ccd6cSJohn Marino    This program is free software: you can redistribute it and/or modify
5*ef5ccd6cSJohn Marino    it under the terms of the GNU General Public License as published by
6*ef5ccd6cSJohn Marino    the Free Software Foundation; either version 3 of the License, or
7*ef5ccd6cSJohn Marino    (at your option) any later version.
8*ef5ccd6cSJohn Marino 
9*ef5ccd6cSJohn Marino    This program is distributed in the hope that it will be useful,
10*ef5ccd6cSJohn Marino    but WITHOUT ANY WARRANTY; without even the implied warranty of
11*ef5ccd6cSJohn Marino    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12*ef5ccd6cSJohn Marino    GNU General Public License for more details.
13*ef5ccd6cSJohn Marino 
14*ef5ccd6cSJohn Marino    You should have received a copy of the GNU General Public License
15*ef5ccd6cSJohn Marino    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
16*ef5ccd6cSJohn Marino 
17*ef5ccd6cSJohn Marino #ifndef _STRNLEN1_H
18*ef5ccd6cSJohn Marino #define _STRNLEN1_H
19*ef5ccd6cSJohn Marino 
20*ef5ccd6cSJohn Marino #include <stddef.h>
21*ef5ccd6cSJohn Marino 
22*ef5ccd6cSJohn Marino 
23*ef5ccd6cSJohn Marino #ifdef __cplusplus
24*ef5ccd6cSJohn Marino extern "C" {
25*ef5ccd6cSJohn Marino #endif
26*ef5ccd6cSJohn Marino 
27*ef5ccd6cSJohn Marino 
28*ef5ccd6cSJohn Marino /* Find the length of STRING + 1, but scan at most MAXLEN bytes.
29*ef5ccd6cSJohn Marino    If no '\0' terminator is found in that many characters, return MAXLEN.  */
30*ef5ccd6cSJohn Marino /* This is the same as strnlen (string, maxlen - 1) + 1.  */
31*ef5ccd6cSJohn Marino extern size_t strnlen1 (const char *string, size_t maxlen)
32*ef5ccd6cSJohn Marino   _GL_ATTRIBUTE_PURE;
33*ef5ccd6cSJohn Marino 
34*ef5ccd6cSJohn Marino 
35*ef5ccd6cSJohn Marino #ifdef __cplusplus
36*ef5ccd6cSJohn Marino }
37*ef5ccd6cSJohn Marino #endif
38*ef5ccd6cSJohn Marino 
39*ef5ccd6cSJohn Marino 
40*ef5ccd6cSJohn Marino #endif /* _STRNLEN1_H */
41