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