[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging] lib: move strchr()
commit 7095953455001bb2d95792bb0b9c822e479b1c57 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Thu Apr 22 14:50:25 2021 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Thu Apr 22 14:50:25 2021 +0200 lib: move strchr() 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/strchr.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 15 deletions(-) diff --git a/xen/common/string.c b/xen/common/string.c index 6042262b49..f433b15afd 100644 --- a/xen/common/string.c +++ b/xen/common/string.c @@ -56,21 +56,6 @@ int (strcasecmp)(const char *s1, const char *s2) } #endif -#ifndef __HAVE_ARCH_STRCHR -/** - * strchr - Find the first occurrence of a character in a string - * @s: The string to be searched - * @c: The character to search for - */ -char *(strchr)(const char *s, int c) -{ - for(; *s != (char) c; ++s) - if (*s == '\0') - return NULL; - return (char *) s; -} -#endif - #ifndef __HAVE_ARCH_STRRCHR /** * strrchr - Find the last occurrence of a character in a string diff --git a/xen/lib/Makefile b/xen/lib/Makefile index 0c6c726adf..b69b516369 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 += strchr.o lib-y += strcmp.o lib-y += strlcat.o lib-y += strlcpy.o diff --git a/xen/lib/strchr.c b/xen/lib/strchr.c new file mode 100644 index 0000000000..2eba3f1574 --- /dev/null +++ b/xen/lib/strchr.c @@ -0,0 +1,28 @@ +/* + * Copyright (C) 1991, 1992 Linus Torvalds + */ + +#include <xen/string.h> + +/** + * strchr - Find the first occurrence of a character in a string + * @s: The string to be searched + * @c: The character to search for + */ +char *(strchr)(const char *s, int c) +{ + for(; *s != (char) c; ++s) + if (*s == '\0') + return NULL; + return (char *) s; +} + +/* + * 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 |