* layout.cc (Layout::create_shstrtab): Only write out after input
[deliverable/binutils-gdb.git] / libiberty / memchr.c
CommitLineData
252b5132 1/*
252b5132 2
39423523 3@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
252b5132 4
99b58139 5This function searches memory starting at @code{*@var{s}} for the
39423523
DD
6character @var{c}. The search only ends with the first occurrence of
7@var{c}, or after @var{length} characters; in particular, a null
8character does not terminate the search. If the character @var{c} is
99b58139
DD
9found within @var{length} characters of @code{*@var{s}}, a pointer
10to the character is returned. If @var{c} is not found, then @code{NULL} is
39423523 11returned.
252b5132 12
39423523 13@end deftypefn
252b5132
RH
14
15*/
16
17#include <ansidecl.h>
252b5132 18#include <stddef.h>
252b5132
RH
19
20PTR
49b1fae4 21memchr (register const PTR src_void, int c, size_t length)
252b5132
RH
22{
23 const unsigned char *src = (const unsigned char *)src_void;
24
30a1def2 25 while (length-- > 0)
252b5132
RH
26 {
27 if (*src == c)
28 return (PTR)src;
29 src++;
30 }
31 return NULL;
32}
This page took 0.393445 seconds and 4 git commands to generate.