diff options
Diffstat (limited to 'posix')
-rw-r--r-- | posix/fnmatch.c | 16 | ||||
-rw-r--r-- | posix/runtests.c | 2 |
2 files changed, 13 insertions, 5 deletions
diff --git a/posix/fnmatch.c b/posix/fnmatch.c index c6cdb88772..4baef9e69b 100644 --- a/posix/fnmatch.c +++ b/posix/fnmatch.c @@ -351,10 +351,14 @@ fnmatch (pattern, string, flags) already done? */ return -1; if (p) - memset (&ps, '\0', sizeof (ps)); + { + memset (&ps, '\0', sizeof (ps)); + goto prepare_wpattern; + } } - if (__builtin_expect (p != NULL, 0)) + else { + prepare_wpattern: n = mbsrtowcs (NULL, &pattern, 0, &ps); if (__builtin_expect (n == (size_t) -1, 0)) /* Something wrong. @@ -383,10 +387,14 @@ fnmatch (pattern, string, flags) already done? */ return -1; if (p) - memset (&ps, '\0', sizeof (ps)); + { + memset (&ps, '\0', sizeof (ps)); + goto prepare_wstring; + } } - if (__builtin_expect (p != NULL, 0)) + else { + prepare_wstring: n = mbsrtowcs (NULL, &string, 0, &ps); if (__builtin_expect (n == (size_t) -1, 0)) /* Something wrong. diff --git a/posix/runtests.c b/posix/runtests.c index 9d744751ea..d44bf36266 100644 --- a/posix/runtests.c +++ b/posix/runtests.c @@ -36,7 +36,7 @@ struct a_test { int expected; const char * pattern; - const unsigned char * data; + const char * data; }; static const struct a_test the_tests[] = |