Revision 16149,
313 bytes
checked in by rbasch, 24 years ago
(diff) |
This commit was generated by cvs2svn to compensate for changes in r16148,
which included commits to RCS files with non-trunk default branches.
|
Rev | Line | |
---|
[16148] | 1 | /* Support memchr on systems where it doesn't work. */ |
---|
| 2 | |
---|
| 3 | #include <config.h> |
---|
| 4 | #include <sys/types.h> |
---|
| 5 | |
---|
| 6 | void * |
---|
| 7 | memchr (s, c, n) |
---|
| 8 | void const *s; |
---|
| 9 | int c; |
---|
| 10 | size_t n; |
---|
| 11 | { |
---|
| 12 | unsigned char const *p = s; |
---|
| 13 | unsigned char const *lim = p + n; |
---|
| 14 | |
---|
| 15 | for (; p < lim; p++) |
---|
| 16 | if (*p == c) |
---|
| 17 | return p; |
---|
| 18 | return 0; |
---|
| 19 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.