* elf32-spu.c (build_stub): Fix malloc under-allocation.
[binutils.git] / libiberty / strchr.c
blob935805ef4f4d236f49be446d7c2c139b60c10996
1 /* Portable version of strchr()
2 This function is in the public domain. */
4 /*
6 @deftypefn Supplemental char* strchr (const char *@var{s}, int @var{c})
8 Returns a pointer to the first occurrence of the character @var{c} in
9 the string @var{s}, or @code{NULL} if not found. If @var{c} is itself the
10 null character, the results are undefined.
12 @end deftypefn
16 #include <ansidecl.h>
18 char *
19 strchr (register const char *s, int c)
21 do {
22 if (*s == c)
24 return (char*)s;
26 } while (*s++);
27 return (0);