mailing list of musl libc
 help / color / mirror / code / Atom feed
2a6983caf4a7253c79605d6b21380cfc979fc810 blob 801 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
 
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include "word.h"

/**
 * strcmp - Word sized c standard strcmp.
 * @c: Comparative
 * @s: Source
 */
#undef strcmp
int strcmp(const char *c, const char *s)
{
	const size_t *wc, *ws;

	if ((uintptr_t)c % sizeof(size_t) != (uintptr_t)s % sizeof(size_t))
		goto misaligned;

	for (; (uintptr_t)c % sizeof(size_t); c++, s++) {
		if (*c != *s || !*c || !*s)
			return *(const unsigned char *)c
			        - *(const unsigned char *)s;
	}

	for (wc = (const size_t *)c, ws = (const size_t *)s
	     ; (!word_has_zero(*wc) || !word_has_zero(*ws)) && *wc == *ws
	     ; wc++, ws++);

	c = (const char *)wc;
	s = (const char *)ws;

misaligned:
	for(; *c == *s && *c && *s; c++, s++);

	return *(const unsigned char *)c - *(const unsigned char *)s;
}
debug log:

solving 2a6983c ...
found 2a6983c in https://inbox.vuxu.org/musl/1359936735-31915-4-git-send-email-nwmcsween@gmail.com/
found 91eb740 in https://git.vuxu.org/mirror/musl/
preparing index
index prepared:
100644 91eb7404fd2bc127c7db8b65038356b1c2ec7873	src/string/strcmp.c

applying [1/1] https://inbox.vuxu.org/musl/1359936735-31915-4-git-send-email-nwmcsween@gmail.com/
diff --git a/src/string/strcmp.c b/src/string/strcmp.c
index 91eb740..2a6983c 100644

Checking patch src/string/strcmp.c...
Applied patch src/string/strcmp.c cleanly.

index at:
100644 2a6983caf4a7253c79605d6b21380cfc979fc810	src/string/strcmp.c

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).