1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-28 00:21:52 +03:00

Thu Mar 14 06:01:07 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>

* string/strnlen.c: New file.
	* string/Makefile (routines): Add strnlen.
	* string/string.h [__USE_GNU] (strnlen): Declare new function.
	[__OPTIMIZE__]: Define extern inline implementation of it.
This commit is contained in:
Roland McGrath
1996-03-14 11:20:23 +00:00
parent 52e9a9d118
commit 8d71c7b0e4
5 changed files with 59 additions and 14 deletions

View File

@ -127,9 +127,26 @@ extern __ptr_t memmem __P ((__const __ptr_t __haystack, size_t __haystacklen,
__const __ptr_t __needle, size_t __needlelen));
#endif
/* Return the length of S. */
extern size_t strlen __P ((__const char *__s));
#ifdef __USE_GNU
/* Find the length of STRING, but scan at most MAXLEN characters.
If no '\0' terminator is found in that many characters, return MAXLEN. */
extern size_t strnlen __P ((__const char *__string, size_t __maxlen));
#ifdef __OPTIMIZE__
extern __inline size_t
strnlen (__const char *__string, size_t __maxlen)
{
__const char *__end = memchr (__string, '\0', __maxlen);
return __end ? __end - __string : __maxlen;
}
#endif
#endif
/* Return a string describing the meaning of the `errno' code in ERRNUM. */
extern char *strerror __P ((int __errnum));
#ifdef __USE_REENTRANT