Deleted Added
full compact
memchr.c (77117) memchr.c (86170)
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 23 unchanged lines hidden (view full) ---

32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93";
39#endif /* LIBC_SCCS and not lint */
1/*-
2 * Copyright (c) 1990, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Chris Torek.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 23 unchanged lines hidden (view full) ---

32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 */
36
37#if defined(LIBC_SCCS) && !defined(lint)
38static char sccsid[] = "@(#)memchr.c 8.1 (Berkeley) 6/4/93";
39#endif /* LIBC_SCCS and not lint */
40#ifndef lint
41static const char rcsid[] =
42 "$FreeBSD: head/lib/libc/string/memchr.c 77117 2001-05-24 08:47:42Z obrien $";
43#endif
44
45#include <sys/cdefs.h>
40#include <sys/cdefs.h>
41__FBSDID("$FreeBSD: head/lib/libc/string/memchr.c 86170 2001-11-07 19:55:16Z obrien $");
42
46#include <string.h>
47
48void *
49memchr(s, c, n)
50 const void *s;
51 register unsigned char c;
52 register size_t n;
53{
54 if (n != 0) {
55 register const unsigned char *p = s;
56
57 do {
58 if (*p++ == c)
59 return ((void *)(p - 1));
60 } while (--n != 0);
61 }
62 return (NULL);
63}
43#include <string.h>
44
45void *
46memchr(s, c, n)
47 const void *s;
48 register unsigned char c;
49 register size_t n;
50{
51 if (n != 0) {
52 register const unsigned char *p = s;
53
54 do {
55 if (*p++ == c)
56 return ((void *)(p - 1));
57 } while (--n != 0);
58 }
59 return (NULL);
60}