From 6ba32f38056ea0b08ec1b49ed01b196db0ac248e Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Mon, 30 Jan 2006 22:48:02 +0000 Subject: strlen is -cheaper- then strnlen --- libc/misc/fnmatch/fnmatch.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'libc/misc/fnmatch/fnmatch.c') 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); -- cgit v1.2.3