diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-30 22:48:02 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-30 22:48:02 +0000 |
commit | 6ba32f38056ea0b08ec1b49ed01b196db0ac248e (patch) | |
tree | 815362b8a1ecb38f4ccfc253bada99789bf2a6c7 /libc/misc/fnmatch/fnmatch.c | |
parent | 2aabb64461dcbee69598a7d12dced2a48c338329 (diff) |
strlen is -cheaper- then strnlen
Diffstat (limited to 'libc/misc/fnmatch/fnmatch.c')
-rw-r--r-- | libc/misc/fnmatch/fnmatch.c | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/libc/misc/fnmatch/fnmatch.c b/libc/misc/fnmatch/fnmatch.c index 5ddfdc333..5a6292c4b 100644 --- a/libc/misc/fnmatch/fnmatch.c +++ b/libc/misc/fnmatch/fnmatch.c @@ -95,7 +95,6 @@ libc_hidden_proto(wcslen) libc_hidden_proto(wcscoll) libc_hidden_proto(towlower) libc_hidden_proto(mbsrtowcs) -libc_hidden_proto(strnlen) # endif # endif #endif @@ -373,17 +372,17 @@ is_char_class (const wchar_t *wcs) # include "fnmatch_loop.c" # endif -extern size_t _stdlib_mb_cur_max (void) __THROW __wur; +#ifdef __UCLIBC_HAS_WCHAR__ libc_hidden_proto(_stdlib_mb_cur_max) +#else +#undef MB_CUR_MAX +#define MB_CUR_MAX 1 +#endif int fnmatch (const char *pattern, const char *string, int flags) { # if HANDLE_MULTIBYTE -# ifdef __UCLIBC_HAS_WCHAR__ -# undef MB_CUR_MAX -# define MB_CUR_MAX (_stdlib_mb_cur_max ()) -# endif if (__builtin_expect (MB_CUR_MAX, 1) != 1) { mbstate_t ps; @@ -395,7 +394,7 @@ fnmatch (const char *pattern, const char *string, int flags) /* Convert the strings into wide characters. */ __memset (&ps, '\0', sizeof (ps)); p = pattern; -#if defined _LIBC || defined __UCLIBC__ +#ifdef _LIBC n = strnlen (pattern, 1024); #else n = strlen (pattern); @@ -426,7 +425,7 @@ fnmatch (const char *pattern, const char *string, int flags) } assert (mbsinit (&ps)); -#if defined _LIBC || defined __UCLIBC__ +#ifdef _LIBC n = strnlen (string, 1024); #else n = strlen (string); |