diff options
Diffstat (limited to 'posix/fnmatch.c')
-rw-r--r-- | posix/fnmatch.c | 16 |
1 files changed, 12 insertions, 4 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. |