[COMMIT master] lib: add strcmp() implementation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Avi Kivity <avi@xxxxxxxxxx>

Signed-off-by: Avi Kivity <avi@xxxxxxxxxx>

diff --git a/lib/libcflat.h b/lib/libcflat.h
index d4ee2e0..0c62e4c 100644
--- a/lib/libcflat.h
+++ b/lib/libcflat.h
@@ -42,6 +42,7 @@ extern void panic(char *fmt, ...);
 
 extern unsigned long strlen(const char *buf);
 extern char *strcat(char *dest, const char *src);
+extern int strcmp(const char *a, const char *b);
 
 extern int printf(const char *fmt, ...);
 extern int vsnprintf(char *buf, int size, const char *fmt, va_list va);
diff --git a/lib/string.c b/lib/string.c
index 1f19f5c..9dc94a1 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -20,6 +20,17 @@ char *strcat(char *dest, const char *src)
     return dest;
 }
 
+int strcmp(const char *a, const char *b)
+{
+    while (*a == *b) {
+	if (*a == '\0') {
+	    break;
+	}
+	++a, ++b;
+    }
+    return *a - *b;
+}
+
 void *memset(void *s, int c, size_t n)
 {
     size_t i;
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM Development]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Walks]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux