xref: /haiku/src/system/libroot/posix/string/strcmp.c (revision 7749d0bb0c358a3279b1b9cc76d8376e900130a5)
1 /*
2  * Copyright 2008, Axel Dörfler, axeld@pinc-software.de.
3  * Distributed under the terms of the MIT license.
4  */
5 
6 
7 #include <stdbool.h>
8 #include <string.h>
9 
10 
11 int
12 strcmp(char const *a, char const *b)
13 {
14 	while (true) {
15 		int cmp = (unsigned char)*a - (unsigned char)*b++;
16 		if (cmp != 0 || *a++ == '\0')
17 			return cmp;
18 	}
19 }
20