THIS IS A TEST INSTANCE ONLY! REPOSITORIES CAN BE DELETED AT ANY TIME!

Browse Source

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>
tags/v2.0.0-rc0
Nguyễn Thái Ngọc Duy Junio C Hamano 6 years ago
parent
commit
70a8fc999d
6 changed files with 0 additions and 91 deletions
  1. +0
    -22
      Makefile
  2. +0
    -10
      config.mak.uname
  3. +0
    -28
      configure.ac
  4. +0
    -12
      git-compat-util.h
  5. +0
    -13
      t/t3070-wildmatch.sh
  6. +0
    -6
      test-wildmatch.c

+ 0
- 22
Makefile View File

@@ -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


+ 0
- 10
config.mak.uname View File

@@ -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


+ 0
- 28
configure.ac View File

@@ -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=],


+ 0
- 12
git-compat-util.h View File

@@ -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);


+ 0
- 13
t/t3070-wildmatch.sh View File

@@ -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() {


+ 0
- 6
test-wildmatch.c View File

@@ -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…
Cancel
Save