mirror of
https://github.com/git/git
synced 2024-11-04 16:17:49 +00:00
stop using fnmatch (either native or compat)
Since v1.8.4 (about six months ago) wildmatch is used as default replacement for fnmatch. We have seen only one fix since so wildmatch probably has done a good job as fnmatch replacement. This concludes the fnmatch->wildmatch transition by no longer relying on fnmatch. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
ff8802283f
commit
70a8fc999d
6 changed files with 0 additions and 91 deletions
22
Makefile
22
Makefile
|
@ -101,14 +101,6 @@ all::
|
|||
#
|
||||
# Define NO_MKSTEMPS if you don't have mkstemps in the C library.
|
||||
#
|
||||
# Define NO_FNMATCH if you don't have fnmatch in the C library.
|
||||
#
|
||||
# Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the
|
||||
# FNM_CASEFOLD GNU extension.
|
||||
#
|
||||
# Define NO_WILDMATCH if you do not want to use Git's wildmatch
|
||||
# implementation as fnmatch
|
||||
#
|
||||
# Define NO_GECOS_IN_PWENT if you don't have pw_gecos in struct passwd
|
||||
# in the C library.
|
||||
#
|
||||
|
@ -1271,20 +1263,6 @@ endif
|
|||
ifdef NO_STRTOULL
|
||||
COMPAT_CFLAGS += -DNO_STRTOULL
|
||||
endif
|
||||
ifdef NO_FNMATCH
|
||||
COMPAT_CFLAGS += -Icompat/fnmatch
|
||||
COMPAT_CFLAGS += -DNO_FNMATCH
|
||||
COMPAT_OBJS += compat/fnmatch/fnmatch.o
|
||||
else
|
||||
ifdef NO_FNMATCH_CASEFOLD
|
||||
COMPAT_CFLAGS += -Icompat/fnmatch
|
||||
COMPAT_CFLAGS += -DNO_FNMATCH_CASEFOLD
|
||||
COMPAT_OBJS += compat/fnmatch/fnmatch.o
|
||||
endif
|
||||
endif
|
||||
ifndef NO_WILDMATCH
|
||||
COMPAT_CFLAGS += -DUSE_WILDMATCH
|
||||
endif
|
||||
ifdef NO_SETENV
|
||||
COMPAT_CFLAGS += -DNO_SETENV
|
||||
COMPAT_OBJS += compat/setenv.o
|
||||
|
|
|
@ -108,7 +108,6 @@ ifeq ($(uname_S),SunOS)
|
|||
NO_MKDTEMP = YesPlease
|
||||
NO_MKSTEMPS = YesPlease
|
||||
NO_REGEX = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
NO_MSGFMT_EXTENDED_OPTIONS = YesPlease
|
||||
HAVE_DEV_TTY = YesPlease
|
||||
ifeq ($(uname_R),5.6)
|
||||
|
@ -259,7 +258,6 @@ ifeq ($(uname_S),IRIX)
|
|||
# issue, comment out the NO_MMAP statement.
|
||||
NO_MMAP = YesPlease
|
||||
NO_REGEX = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
SNPRINTF_RETURNS_BOGUS = YesPlease
|
||||
SHELL_PATH = /usr/gnu/bin/bash
|
||||
NEEDS_LIBGEN = YesPlease
|
||||
|
@ -279,7 +277,6 @@ ifeq ($(uname_S),IRIX64)
|
|||
# issue, comment out the NO_MMAP statement.
|
||||
NO_MMAP = YesPlease
|
||||
NO_REGEX = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
SNPRINTF_RETURNS_BOGUS = YesPlease
|
||||
SHELL_PATH = /usr/gnu/bin/bash
|
||||
NEEDS_LIBGEN = YesPlease
|
||||
|
@ -296,7 +293,6 @@ ifeq ($(uname_S),HP-UX)
|
|||
NO_UNSETENV = YesPlease
|
||||
NO_HSTRERROR = YesPlease
|
||||
NO_SYS_SELECT_H = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
SNPRINTF_RETURNS_BOGUS = YesPlease
|
||||
NO_NSEC = YesPlease
|
||||
ifeq ($(uname_R),B.11.00)
|
||||
|
@ -327,7 +323,6 @@ ifeq ($(uname_S),Windows)
|
|||
NO_UNSETENV = YesPlease
|
||||
NO_STRCASESTR = YesPlease
|
||||
NO_STRLCPY = YesPlease
|
||||
NO_FNMATCH = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
# NEEDS_LIBICONV = YesPlease
|
||||
NO_ICONV = YesPlease
|
||||
|
@ -389,13 +384,11 @@ ifeq ($(uname_S),Interix)
|
|||
NO_INET_NTOP = YesPlease
|
||||
NO_INET_PTON = YesPlease
|
||||
NO_SOCKADDR_STORAGE = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
endif
|
||||
ifeq ($(uname_R),5.2)
|
||||
NO_INET_NTOP = YesPlease
|
||||
NO_INET_PTON = YesPlease
|
||||
NO_SOCKADDR_STORAGE = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
endif
|
||||
endif
|
||||
ifeq ($(uname_S),Minix)
|
||||
|
@ -440,7 +433,6 @@ ifeq ($(uname_S),NONSTOP_KERNEL)
|
|||
NO_D_TYPE_IN_DIRENT = YesPlease
|
||||
NO_HSTRERROR = YesPlease
|
||||
NO_STRCASESTR = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
NO_STRLCPY = YesPlease
|
||||
NO_SETENV = YesPlease
|
||||
|
@ -484,7 +476,6 @@ ifneq (,$(findstring MINGW,$(uname_S)))
|
|||
NO_UNSETENV = YesPlease
|
||||
NO_STRCASESTR = YesPlease
|
||||
NO_STRLCPY = YesPlease
|
||||
NO_FNMATCH = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
NEEDS_LIBICONV = YesPlease
|
||||
NO_STRTOUMAX = YesPlease
|
||||
|
@ -538,7 +529,6 @@ ifeq ($(uname_S),QNX)
|
|||
EXPAT_NEEDS_XMLPARSE_H = YesPlease
|
||||
HAVE_STRINGS_H = YesPlease
|
||||
NEEDS_SOCKET = YesPlease
|
||||
NO_FNMATCH_CASEFOLD = YesPlease
|
||||
NO_GETPAGESIZE = YesPlease
|
||||
NO_ICONV = YesPlease
|
||||
NO_MEMMEM = YesPlease
|
||||
|
|
28
configure.ac
28
configure.ac
|
@ -901,34 +901,6 @@ GIT_CHECK_FUNC(strcasestr,
|
|||
[NO_STRCASESTR=YesPlease])
|
||||
GIT_CONF_SUBST([NO_STRCASESTR])
|
||||
#
|
||||
# Define NO_FNMATCH if you don't have fnmatch
|
||||
GIT_CHECK_FUNC(fnmatch,
|
||||
[NO_FNMATCH=],
|
||||
[NO_FNMATCH=YesPlease])
|
||||
GIT_CONF_SUBST([NO_FNMATCH])
|
||||
#
|
||||
# Define NO_FNMATCH_CASEFOLD if your fnmatch function doesn't have the
|
||||
# FNM_CASEFOLD GNU extension.
|
||||
AC_CACHE_CHECK([whether the fnmatch function supports the FNMATCH_CASEFOLD GNU extension],
|
||||
[ac_cv_c_excellent_fnmatch], [
|
||||
AC_EGREP_CPP(yippeeyeswehaveit,
|
||||
AC_LANG_PROGRAM([
|
||||
#include <fnmatch.h>
|
||||
],
|
||||
[#ifdef FNM_CASEFOLD
|
||||
yippeeyeswehaveit
|
||||
#endif
|
||||
]),
|
||||
[ac_cv_c_excellent_fnmatch=yes],
|
||||
[ac_cv_c_excellent_fnmatch=no])
|
||||
])
|
||||
if test $ac_cv_c_excellent_fnmatch = yes; then
|
||||
NO_FNMATCH_CASEFOLD=
|
||||
else
|
||||
NO_FNMATCH_CASEFOLD=YesPlease
|
||||
fi
|
||||
GIT_CONF_SUBST([NO_FNMATCH_CASEFOLD])
|
||||
#
|
||||
# Define NO_MEMMEM if you don't have memmem.
|
||||
GIT_CHECK_FUNC(memmem,
|
||||
[NO_MEMMEM=],
|
||||
|
|
|
@ -116,9 +116,6 @@
|
|||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#ifndef USE_WILDMATCH
|
||||
#include <fnmatch.h>
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#include <regex.h>
|
||||
#include <utime.h>
|
||||
|
@ -304,16 +301,7 @@ extern char *gitbasename(char *);
|
|||
|
||||
#include "compat/bswap.h"
|
||||
|
||||
#ifdef USE_WILDMATCH
|
||||
#include "wildmatch.h"
|
||||
#define FNM_PATHNAME WM_PATHNAME
|
||||
#define FNM_CASEFOLD WM_CASEFOLD
|
||||
#define FNM_NOMATCH WM_NOMATCH
|
||||
static inline int fnmatch(const char *pattern, const char *string, int flags)
|
||||
{
|
||||
return wildmatch(pattern, string, flags, NULL);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* General helper functions */
|
||||
extern void vreportf(const char *prefix, const char *err, va_list params);
|
||||
|
|
|
@ -14,19 +14,6 @@ match() {
|
|||
! test-wildmatch wildmatch '$3' '$4'
|
||||
"
|
||||
fi
|
||||
if [ $2 = 1 ]; then
|
||||
test_expect_success "fnmatch: match '$3' '$4'" "
|
||||
test-wildmatch fnmatch '$3' '$4'
|
||||
"
|
||||
elif [ $2 = 0 ]; then
|
||||
test_expect_success "fnmatch: no match '$3' '$4'" "
|
||||
! test-wildmatch fnmatch '$3' '$4'
|
||||
"
|
||||
# else
|
||||
# test_expect_success BROKEN_FNMATCH "fnmatch: '$3' '$4'" "
|
||||
# ! test-wildmatch fnmatch '$3' '$4'
|
||||
# "
|
||||
fi
|
||||
}
|
||||
|
||||
imatch() {
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
#ifdef USE_WILDMATCH
|
||||
#undef USE_WILDMATCH /* We need real fnmatch implementation here */
|
||||
#endif
|
||||
#include "cache.h"
|
||||
#include "wildmatch.h"
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
|
@ -20,8 +16,6 @@ int main(int argc, char **argv)
|
|||
return !!wildmatch(argv[3], argv[2], WM_PATHNAME | WM_CASEFOLD, NULL);
|
||||
else if (!strcmp(argv[1], "pathmatch"))
|
||||
return !!wildmatch(argv[3], argv[2], 0, NULL);
|
||||
else if (!strcmp(argv[1], "fnmatch"))
|
||||
return !!fnmatch(argv[3], argv[2], FNM_PATHNAME);
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue