|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] lib: move strsep()
commit 4f7bfefe79f417a657dba5bd25129dd6961e8de7
Author: Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Apr 22 14:53:21 2021 +0200
Commit: Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Apr 22 14:53:21 2021 +0200
lib: move strsep()
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/Makefile | 1 -
xen/common/string.c | 47 -----------------------------------------------
xen/lib/Makefile | 1 +
xen/lib/strsep.c | 41 +++++++++++++++++++++++++++++++++++++++++
4 files changed, 42 insertions(+), 48 deletions(-)
diff --git a/xen/common/Makefile b/xen/common/Makefile
index e2a7e62d14..54de70d422 100644
--- a/xen/common/Makefile
+++ b/xen/common/Makefile
@@ -40,7 +40,6 @@ obj-y += softirq.o
obj-y += smp.o
obj-y += spinlock.o
obj-y += stop_machine.o
-obj-y += string.o
obj-y += symbols.o
obj-y += tasklet.o
obj-y += time.o
diff --git a/xen/common/string.c b/xen/common/string.c
deleted file mode 100644
index 05cd199b61..0000000000
--- a/xen/common/string.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * linux/lib/string.c
- *
- * Copyright (C) 1991, 1992 Linus Torvalds
- */
-
-#include <xen/types.h>
-#include <xen/string.h>
-#include <xen/ctype.h>
-
-#ifndef __HAVE_ARCH_STRSEP
-/**
- * strsep - Split a string into tokens
- * @s: The string to be searched
- * @ct: The characters to search for
- *
- * strsep() updates @s to point after the token, ready for the next call.
- *
- * It returns empty tokens, too, behaving exactly like the libc function
- * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
- * Same semantics, slimmer shape. ;)
- */
-char * strsep(char **s, const char *ct)
-{
- char *sbegin = *s, *end;
-
- if (sbegin == NULL)
- return NULL;
-
- end = strpbrk(sbegin, ct);
- if (end)
- *end++ = '\0';
- *s = end;
-
- return sbegin;
-}
-#endif
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 8
- * tab-width: 8
- * indent-tabs-mode: t
- * End:
- */
diff --git a/xen/lib/Makefile b/xen/lib/Makefile
index dd96bd0d90..b311ea739c 100644
--- a/xen/lib/Makefile
+++ b/xen/lib/Makefile
@@ -25,6 +25,7 @@ lib-y += strncmp.o
lib-y += strnlen.o
lib-y += strpbrk.o
lib-y += strrchr.o
+lib-y += strsep.o
lib-y += strspn.o
lib-y += strstr.o
lib-$(CONFIG_X86) += xxhash32.o
diff --git a/xen/lib/strsep.c b/xen/lib/strsep.c
new file mode 100644
index 0000000000..0bda9901c2
--- /dev/null
+++ b/xen/lib/strsep.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 1991, 1992 Linus Torvalds
+ */
+
+#include <xen/string.h>
+
+/**
+ * strsep - Split a string into tokens
+ * @s: The string to be searched
+ * @ct: The characters to search for
+ *
+ * strsep() updates @s to point after the token, ready for the next call.
+ *
+ * It returns empty tokens, too, behaving exactly like the libc function
+ * of that name. In fact, it was stolen from glibc2 and de-fancy-fied.
+ * Same semantics, slimmer shape. ;)
+ */
+char *strsep(char **s, const char *ct)
+{
+ char *sbegin = *s, *end;
+
+ if (sbegin == NULL)
+ return NULL;
+
+ end = strpbrk(sbegin, ct);
+ if (end)
+ *end++ = '\0';
+ *s = end;
+
+ return sbegin;
+}
+
+/*
+ * 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 |