]> git.saurik.com Git - apple/libc.git/blame - string/FreeBSD/strcasestr.c.patch
Libc-763.13.tar.gz
[apple/libc.git] / string / FreeBSD / strcasestr.c.patch
CommitLineData
1f2f436a
A
1--- strcasestr.c.bsdnew 2009-11-18 18:24:33.000000000 -0800
2+++ strcasestr.c 2009-11-18 18:24:33.000000000 -0800
3@@ -33,6 +33,8 @@
3d9156a7 4 #include <sys/cdefs.h>
1f2f436a 5 __FBSDID("$FreeBSD: src/lib/libc/string/strcasestr.c,v 1.5 2009/02/03 17:58:20 danger Exp $");
3d9156a7
A
6
7+#include "xlocale_private.h"
8+
9 #include <ctype.h>
10 #include <string.h>
11
1f2f436a 12@@ -40,21 +42,30 @@ __FBSDID("$FreeBSD: src/lib/libc/string/
3d9156a7
A
13 * Find the first occurrence of find in s, ignore case.
14 */
15 char *
1f2f436a 16-strcasestr(const char *s, const char *find)
3d9156a7 17+strcasestr_l(s, find, loc)
1f2f436a 18+ const char *s, *find;
3d9156a7
A
19+ locale_t loc;
20 {
21 char c, sc;
22 size_t len;
23
24+ NORMALIZE_LOCALE(loc);
25 if ((c = *find++) != 0) {
26- c = tolower((unsigned char)c);
27+ c = tolower_l((unsigned char)c, loc);
28 len = strlen(find);
29 do {
30 do {
31 if ((sc = *s++) == 0)
32 return (NULL);
33- } while ((char)tolower((unsigned char)sc) != c);
34- } while (strncasecmp(s, find, len) != 0);
35+ } while ((char)tolower_l((unsigned char)sc, loc) != c);
36+ } while (strncasecmp_l(s, find, len, loc) != 0);
37 s--;
38 }
39 return ((char *)s);
40 }
41+
42+char *
1f2f436a 43+strcasestr(const char *s, const char *find)
3d9156a7
A
44+{
45+ return strcasestr_l(s, find, __current_locale());
46+}