summaryrefslogtreecommitdiff
path: root/modules/fnmatch
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2020-05-31 10:14:41 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2020-05-31 10:15:31 -0700
commit67306f600fe6a3bcf3fbb6d8bf4b8953b74a8fb7 (patch)
treebc875a8d73eeb3dec77730a8699c6a929e1210b6 /modules/fnmatch
parent9de2f9ad0a12f0c048e9c9e573f77f35288f0c43 (diff)
downloadgnulib-67306f600fe6a3bcf3fbb6d8bf4b8953b74a8fb7.tar.gz
fnmatch: merge from glibc
Also, merge in Gnulib’s more-recent methods of making it easier to share between Gnulib and glibc. * lib/fnmatch.c: Reorder includes to match glibc better. Include libc-config.h instead of config.h. Include alloca.h only if _LIBC || HAVE_ALLOCA. Do not include "../locale/elem-hash.h" if _LIBC. Define macros for btowc, etc. if _LIBC. All uses simplified. Define FALLTHROUGH if _LIBC, instead of including attribute.h. Include intprops.h, since glibc has it now. (SIZE_MAX): Remove; use (size_t) -1 instead. Omit the "Comment out all this code" ifdef, since Gnulib has never really needed it. (STREQ): Remove; no longer used. (__libc_use_alloca, alloca, alloca_account): Define as needed if !_LIBC. (ISWCTYPE): Remove; all uses replaced by iswctype. (HANDLE_MULTIBYTE): Remove. All uses removed by assuming true. (internal_function): Remove. All uses removed. (STRUCT): New macro. (WIDE_CHAR_VERSION): Define to 0 instead of leaving undefined. (WMEMCMP): New macro. (FINDIDX): Define if _LIBC, and include <locale/weight.h> and <locale/weightwc.h>. (fnmatch): Prefer __glibc_likely and __glibc_unlikely to __builtin_expect. Check for integer overflow more systematically. Account for alloca storage better when recursive. Use strnlen instead of strlen for efficiency. * lib/fnmatch_loop.c: Include stdint.h if _LIBC, for int32_t etc. (struct STRUCT): New type. (FCT, EXT): New ENDS and ALLOCA_USED args. All callers changed. (FCT): Prefer __glibc_unlikely to __builtin_expect. Simplify by assuming WIDE_CHAR_SUPPORT. Copy _LIBC code from glibc without worrying Gnulib compatibility. Cast cold to UCHAR to avoid signedness warning. (END): Check for invalid pattern. (EXT): Improve alloca/malloc checking (taken from glibc), and improve it some more by using intprops.h and checking for integer overflow and using bool for booleans. * lib/libc-config.h (compat_symbol): New macro. (versioned_symbol): Make it ‘extern int dummy’ so that it’s acceptable to non-GCC when a trailing semicolon is added. * modules/fnmatch (Depends-on): Add alloca-opt, intprops, libc-config, strnlen. Remove alloca.
Diffstat (limited to 'modules/fnmatch')
-rw-r--r--modules/fnmatch5
1 files changed, 4 insertions, 1 deletions
diff --git a/modules/fnmatch b/modules/fnmatch
index 4fc5a3b6af..f547670214 100644
--- a/modules/fnmatch
+++ b/modules/fnmatch
@@ -9,14 +9,17 @@ m4/fnmatch.m4
Depends-on:
fnmatch-h
-alloca [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
+alloca-opt [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
attribute [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
btowc [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
builtin-expect [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
flexmember [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
+intprops [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
isblank [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
iswctype [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
+libc-config [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
stdbool [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
+strnlen [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
wchar [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
wctype-h [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]
wmemchr [test $HAVE_FNMATCH = 0 || test $REPLACE_FNMATCH = 1]