mirror of
https://gcc.gnu.org/git/gcc.git
synced 2024-11-27 13:54:19 +08:00
996c0cb05f
libiberty/: * splay-tree.c: Escape wrapping newlines in texinfo markup with '@', to fix function declaration output rendering. * gather-docs: Relax and improve macro name matching to actually match all current names and to allow input line wrapping. * bsearch.c, concat.c, crc32.c, fnmatch.txh, fopen_unlocked.c, hashtab.c, insque.c, make-relative-prefix.c, memchr.c, memcmp.c, memcpy.c, memmem.c, memmove.c, mempcpy.c, memset.c, pexecute.txh, random.c, setenv.c, setproctitle.c, simple-object.txh, snprintf.c, stpncpy.c, strncmp.c, strtod.c, strtol.c, vasprintf.c, vprintf.c, vsnprintf.c, xmemdup.c: Wrap long texinfo input lines. * functions.texi: Regenerate. From-SVN: r169783
34 lines
815 B
C
34 lines
815 B
C
/*
|
|
|
|
@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, @
|
|
size_t @var{n})
|
|
|
|
This function searches memory starting at @code{*@var{s}} for the
|
|
character @var{c}. The search only ends with the first occurrence of
|
|
@var{c}, or after @var{length} characters; in particular, a null
|
|
character does not terminate the search. If the character @var{c} is
|
|
found within @var{length} characters of @code{*@var{s}}, a pointer
|
|
to the character is returned. If @var{c} is not found, then @code{NULL} is
|
|
returned.
|
|
|
|
@end deftypefn
|
|
|
|
*/
|
|
|
|
#include <ansidecl.h>
|
|
#include <stddef.h>
|
|
|
|
PTR
|
|
memchr (register const PTR src_void, int c, size_t length)
|
|
{
|
|
const unsigned char *src = (const unsigned char *)src_void;
|
|
|
|
while (length-- > 0)
|
|
{
|
|
if (*src == c)
|
|
return (PTR)src;
|
|
src++;
|
|
}
|
|
return NULL;
|
|
}
|