Deleted Added
full compact
strcmp.c (165903) strcmp.c (188080)
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

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
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

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

29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 * SUCH DAMAGE.
31 */
32
33#if defined(LIBC_SCCS) && !defined(lint)
34static char sccsid[] = "@(#)strcmp.c 8.1 (Berkeley) 6/4/93";
35#endif /* LIBC_SCCS and not lint */
36#include <sys/cdefs.h>
37__FBSDID("$FreeBSD: head/lib/libc/string/strcmp.c 165903 2007-01-09 00:28:16Z imp $");
37__FBSDID("$FreeBSD: head/lib/libc/string/strcmp.c 188080 2009-02-03 17:58:20Z danger $");
38
39#include <string.h>
40
41/*
42 * Compare strings.
43 */
44int
38
39#include <string.h>
40
41/*
42 * Compare strings.
43 */
44int
45strcmp(s1, s2)
46 const char *s1, *s2;
45strcmp(const char *s1, const char *s2)
47{
48 while (*s1 == *s2++)
46{
47 while (*s1 == *s2++)
49 if (*s1++ == 0)
48 if (*s1++ == '\0')
50 return (0);
51 return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
52}
49 return (0);
50 return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
51}