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

[xen master] lib: move strpbrk()



commit 4a0630eae4f1eb0ede38511fb97f19673299aac4
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Apr 22 14:53:10 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Apr 22 14:53:10 2021 +0200

    lib: move strpbrk()
    
    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 | 20 --------------------
 xen/lib/Makefile    |  1 +
 xen/lib/strpbrk.c   | 33 +++++++++++++++++++++++++++++++++
 3 files changed, 34 insertions(+), 20 deletions(-)

diff --git a/xen/common/string.c b/xen/common/string.c
index 6310facebd..05cd199b61 100644
--- a/xen/common/string.c
+++ b/xen/common/string.c
@@ -8,26 +8,6 @@
 #include <xen/string.h>
 #include <xen/ctype.h>
 
-#ifndef __HAVE_ARCH_STRPBRK
-/**
- * strpbrk - Find the first occurrence of a set of characters
- * @cs: The string to be searched
- * @ct: The characters to search for
- */
-char * strpbrk(const char * cs,const char * ct)
-{
-       const char *sc1,*sc2;
-
-       for( sc1 = cs; *sc1 != '\0'; ++sc1) {
-               for( sc2 = ct; *sc2 != '\0'; ++sc2) {
-                       if (*sc1 == *sc2)
-                               return (char *) sc1;
-               }
-       }
-       return NULL;
-}
-#endif
-
 #ifndef __HAVE_ARCH_STRSEP
 /**
  * strsep - Split a string into tokens
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index 4126fdd05e..dd96bd0d90 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -23,6 +23,7 @@ lib-y += strlen.o
 lib-y += strncasecmp.o
 lib-y += strncmp.o
 lib-y += strnlen.o
+lib-y += strpbrk.o
 lib-y += strrchr.o
 lib-y += strspn.o
 lib-y += strstr.o
diff --git a/xen/lib/strpbrk.c b/xen/lib/strpbrk.c
new file mode 100644
index 0000000000..54c15784c4
--- /dev/null
+++ b/xen/lib/strpbrk.c
@@ -0,0 +1,33 @@
+/*
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strpbrk - Find the first occurrence of a set of characters
+ * @cs: The string to be searched
+ * @ct: The characters to search for
+ */
+char *strpbrk(const char * cs,const char * ct)
+{
+       const char *sc1,*sc2;
+
+       for( sc1 = cs; *sc1 != '\0'; ++sc1) {
+               for( sc2 = ct; *sc2 != '\0'; ++sc2) {
+                       if (*sc1 == *sc2)
+                               return (char *) sc1;
+               }
+       }
+       return NULL;
+}
+
+/*
+ * 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®.