|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] lib: move strcmp()
commit 4d0e3e734676c48b405c80344ba97060fcc0cad8
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Apr 22 14:48:25 2021 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Apr 22 14:48:25 2021 +0200
lib: move strcmp()
Allow the function to be individually linkable, discardable, and
overridable.
Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
Acked-by: Julien Grall <jgrall@xxxxxxxxxx>
---
xen/common/string.c | 19 -------------------
xen/lib/Makefile | 1 +
xen/lib/strcmp.c | 32 ++++++++++++++++++++++++++++++++
3 files changed, 33 insertions(+), 19 deletions(-)
diff --git a/xen/common/string.c b/xen/common/string.c
index 6be445e26e..1d8cd0ab05 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -111,25 +111,6 @@ size_t strlcat(char *dest, const char *src, size_t size)
EXPORT_SYMBOL(strlcat);
#endif
-#ifndef __HAVE_ARCH_STRCMP
-/**
- * strcmp - Compare two strings
- * @cs: One string
- * @ct: Another string
- */
-int (strcmp)(const char *cs, const char *ct)
-{
- register signed char __res;
-
- while (1) {
- if ((__res = *cs - *ct++) != 0 || !*cs++)
- break;
- }
-
- return __res;
-}
-#endif
-
#ifndef __HAVE_ARCH_STRNCMP
/**
* strncmp - Compare two length-limited strings
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 1a642c929f..c85fed7d01 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -14,6 +14,7 @@ lib-y += muldiv64.o
lib-y += parse-size.o
lib-y += rbtree.o
lib-y += sort.o
+lib-y += strcmp.o
lib-y += strlen.o
lib-y += strnlen.o
lib-$(CONFIG_X86) += xxhash32.o
diff --git a/xen/lib/strcmp.c b/xen/lib/strcmp.c
new file mode 100644
index 0000000000..465f1c4191
--- /dev/null
+++ b/xen/lib/strcmp.c
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 1991, 1992 Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strcmp - Compare two strings
+ * @cs: One string
+ * @ct: Another string
+ */
+int (strcmp)(const char *cs, const char *ct)
+{
+ register signed char __res;
+
+ while (1) {
+ if ((__res = *cs - *ct++) != 0 || !*cs++)
+ break;
+ }
+
+ return __res;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 8
+ * tab-width: 8
+ * indent-tabs-mode: t
+ * End:
+ */
--
generated by git-patchbot for /home/xen/git/xen.git#staging
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |