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

[xen master] lib: move strcasecmp()



commit 50ee4fb90a525c9b543cabe78a3df6d8588bba30
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Apr 22 14:51:08 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Apr 22 14:51:08 2021 +0200

    lib: move strcasecmp()
    
    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  | 15 ---------------
 xen/lib/Makefile     |  1 +
 xen/lib/strcasecmp.c | 29 +++++++++++++++++++++++++++++
 3 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index abb1689edd..2b81daef89 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -41,21 +41,6 @@ int strnicmp(const char *s1, const char *s2, size_t len)
 }
 #endif
 
-#ifndef __HAVE_ARCH_STRCASECMP
-int (strcasecmp)(const char *s1, const char *s2)
-{
-    int c1, c2;
-
-    do
-    {
-        c1 = tolower(*s1++);
-        c2 = tolower(*s2++);
-    } while ( c1 == c2 && c1 != 0 );
-
-    return c1 - c2;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSPN
 /**
  * strspn - Calculate the length of the initial substring of @s which only
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 57a7095ffa..6264b3aae3 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 += strcasecmp.o
 lib-y += strchr.o
 lib-y += strcmp.o
 lib-y += strlcat.o
diff --git a/xen/lib/strcasecmp.c b/xen/lib/strcasecmp.c
new file mode 100644
index 0000000000..c2a411310e
--- /dev/null
+++ b/xen/lib/strcasecmp.c
@@ -0,0 +1,29 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+#include <xen/ctype.h>
+
+int (strcasecmp)(const char *s1, const char *s2)
+{
+    int c1, c2;
+
+    do
+    {
+        c1 = tolower(*s1++);
+        c2 = tolower(*s2++);
+    } while ( c1 == c2 && c1 != 0 );
+
+    return c1 - c2;
+}
+
+/*
+ * 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#master



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.