summaryrefslogtreecommitdiffstats
path: root/contrib/binutils/libiberty/memchr.c
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2002-01-27 12:00:11 +0000
committerobrien <obrien@FreeBSD.org>2002-01-27 12:00:11 +0000
commitfc89183cdc6be5afa8deb7250fd15a20832ab528 (patch)
tree5c493199a70976c54e1b9c6a7804a3de85b43e84 /contrib/binutils/libiberty/memchr.c
parent94820fd8060f6f43089d1a3ddb8a482402e7e494 (diff)
downloadFreeBSD-src-fc89183cdc6be5afa8deb7250fd15a20832ab528.zip
FreeBSD-src-fc89183cdc6be5afa8deb7250fd15a20832ab528.tar.gz
Enlist the FreeBSD-CURRENT users as testers of what is to become Binutils
version 2.12.0. These bits are taken from the FSF anoncvs repo on 27-January-2002 03:41 PST.
Diffstat (limited to 'contrib/binutils/libiberty/memchr.c')
-rw-r--r--contrib/binutils/libiberty/memchr.c41
1 files changed, 10 insertions, 31 deletions
diff --git a/contrib/binutils/libiberty/memchr.c b/contrib/binutils/libiberty/memchr.c
index cce3003..f94bea0 100644
--- a/contrib/binutils/libiberty/memchr.c
+++ b/contrib/binutils/libiberty/memchr.c
@@ -1,37 +1,16 @@
/*
-FUNCTION
- <<memchr>>---find character in memory
-INDEX
- memchr
+@deftypefn Supplemental void* memchr (const void *@var{s}, int @var{c}, size_t @var{n})
-ANSI_SYNOPSIS
- #include <string.h>
- void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>);
+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.
-TRAD_SYNOPSIS
- #include <string.h>
- void *memchr(<[src]>, <[c]>, <[length]>)
- void *<[src]>;
- void *<[c]>;
- size_t <[length]>;
-
-DESCRIPTION
- This function searches memory starting at <<*<[src]>>> for the
- character <[c]>. The search only ends with the first
- occurrence of <[c]>, or after <[length]> characters; in
- particular, <<NULL>> does not terminate the search.
-
-RETURNS
- If the character <[c]> is found within <[length]> characters
- of <<*<[src]>>>, a pointer to the character is returned. If
- <[c]> is not found, then <<NULL>> is returned.
-
-PORTABILITY
-<<memchr>> requires no supporting OS subroutines.
-
-QUICKREF
- memchr ansi pure
+@end deftypefn
*/
@@ -50,7 +29,7 @@ memchr (src_void, c, length)
{
const unsigned char *src = (const unsigned char *)src_void;
- while (--length >= 0)
+ while (length-- > 0)
{
if (*src == c)
return (PTR)src;
OpenPOWER on IntegriCloud