Date: Thu, 7 Jan 2021 23:20:51 GMT From: Vladimir Kondratyev <wulf@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Subject: git: bc861033357e - main - libkern/strcasestr.c: Drop xlocale support and connect to build. Message-ID: <202101072320.107NKpuv063357@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch main has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=bc861033357ef2d2eeaf5d85d70bb4b638961b2d commit bc861033357ef2d2eeaf5d85d70bb4b638961b2d Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2020-10-06 14:50:52 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2021-01-07 23:18:42 +0000 libkern/strcasestr.c: Drop xlocale support and connect to build. Reviewed by: markj, hselasky Differential revision: https://reviews.freebsd.org/D27866 --- sys/conf/files | 1 + sys/libkern/strcasestr.c | 22 ++++++++-------------- sys/sys/libkern.h | 1 + 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/sys/conf/files b/sys/conf/files index 0258fca24836..7cfb32560af6 100644 --- a/sys/conf/files +++ b/sys/conf/files @@ -4058,6 +4058,7 @@ libkern/qsort_r.c standard libkern/random.c standard libkern/scanc.c standard libkern/strcasecmp.c standard +libkern/strcasestr.c standard libkern/strcat.c standard libkern/strchr.c standard libkern/strchrnul.c optional gdb diff --git a/sys/libkern/strcasestr.c b/sys/libkern/strcasestr.c index b70c2195a94e..c0418cfaeb3d 100644 --- a/sys/libkern/strcasestr.c +++ b/sys/libkern/strcasestr.c @@ -40,35 +40,29 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <ctype.h> -#include <string.h> -#include "xlocale_private.h" +#include <sys/param.h> +#include <sys/ctype.h> +#include <sys/libkern.h> /* * Find the first occurrence of find in s, ignore case. */ char * -strcasestr_l(const char *s, const char *find, locale_t locale) +strcasestr(const char *s, const char *find) { char c, sc; size_t len; - FIX_LOCALE(locale); if ((c = *find++) != 0) { - c = tolower_l((unsigned char)c, locale); + c = tolower((unsigned char)c); len = strlen(find); do { do { if ((sc = *s++) == 0) return (NULL); - } while ((char)tolower_l((unsigned char)sc, locale) != c); - } while (strncasecmp_l(s, find, len, locale) != 0); + } while ((char)tolower((unsigned char)sc) != c); + } while (strncasecmp(s, find, len) != 0); s--; } - return ((char *)s); -} -char * -strcasestr(const char *s, const char *find) -{ - return strcasestr_l(s, find, __get_locale()); + return (__DECONST(char *, s)); } diff --git a/sys/sys/libkern.h b/sys/sys/libkern.h index 7385df139297..3874ef9ec4bd 100644 --- a/sys/sys/libkern.h +++ b/sys/sys/libkern.h @@ -168,6 +168,7 @@ void qsort_r(void *base, size_t nmemb, size_t size, void *thunk, u_long random(void); int scanc(u_int, const u_char *, const u_char *, int); int strcasecmp(const char *, const char *); +char *strcasestr(const char *, const char *); char *strcat(char * __restrict, const char * __restrict); char *strchr(const char *, int); char *strchrnul(const char *, int);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101072320.107NKpuv063357>