Remove unused regex code

Regex matching was disabled in f6244d2cf2
This commit is contained in:
Behdad Esfahbod 2014-07-24 15:42:54 -04:00
parent 9a8e812477
commit 874a549164
3 changed files with 2 additions and 66 deletions

View File

@ -138,7 +138,7 @@ dnl ==========================================================================
# Checks for header files.
AC_HEADER_DIRENT
AC_HEADER_STDC
AC_CHECK_HEADERS([fcntl.h regex.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h])
AC_CHECK_HEADERS([fcntl.h stdlib.h string.h unistd.h sys/statvfs.h sys/vfs.h sys/statfs.h sys/param.h sys/mount.h])
AX_CREATE_STDINT_H([src/fcstdint.h])
# Checks for typedefs, structures, and compiler characteristics.
@ -150,7 +150,7 @@ AC_TYPE_PID_T
# Checks for library functions.
AC_FUNC_VPRINTF
AC_FUNC_MMAP
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink regcomp regerror regexec regfree fstatvfs fstatfs lstat])
AC_CHECK_FUNCS([link mkstemp mkostemp _mktemp_s mkdtemp getopt getopt_long getprogname getexecname rand random lrand48 random_r rand_r readlink fstatvfs fstatfs lstat])
dnl AC_CHECK_FUNCS doesn't check for header files.
dnl posix_fadvise() may be not available in older libc.
@ -211,12 +211,6 @@ if test "x$ac_cv_func_fstatfs" = "xyes"; then
fi
AC_CHECK_MEMBERS([struct dirent.d_type],,,
[#include <dirent.h>])
#
# regex
#
if test "x$ac_cv_func_regcomp" = "xyes" -a "x$ac_cv_func_regerror" = "xyes" -a "x$ac_cv_func_regexec" = "xyes" -a "x$ac_cv_func_regfree"; then
AC_DEFINE(USE_REGEX,,[Use regex])
fi
#
# Checks for iconv

View File

@ -1152,12 +1152,6 @@ FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
FcPrivate int
FcStrCmpIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims);
FcPrivate FcBool
FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex);
FcPrivate FcBool
FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex);
FcPrivate const FcChar8 *
FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);

View File

@ -26,9 +26,6 @@
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#ifdef HAVE_REGEX_H
#include <regex.h>
#endif
/* Objects MT-safe for readonly access. */
@ -242,55 +239,6 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2)
return (int) c1 - (int) c2;
}
#ifdef USE_REGEX
static FcBool
_FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags)
{
int ret = -1;
regex_t reg;
if ((ret = regcomp (&reg, (const char *)regex, cflags)) != 0)
{
if (FcDebug () & FC_DBG_MATCHV)
{
char buf[512];
regerror (ret, &reg, buf, 512);
printf("Regexp compile error: %s\n", buf);
}
return FcFalse;
}
ret = regexec (&reg, (const char *)s, 0, NULL, eflags);
if (ret != 0)
{
if (FcDebug () & FC_DBG_MATCHV)
{
char buf[512];
regerror (ret, &reg, buf, 512);
printf("Regexp exec error: %s\n", buf);
}
}
regfree (&reg);
return ret == 0 ? FcTrue : FcFalse;
}
#else
# define _FcStrRegexCmp(_s_, _regex_, _cflags_, _eflags_) (FcFalse)
#endif
FcBool
FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex)
{
return _FcStrRegexCmp (s, regex, REG_EXTENDED | REG_NOSUB, 0);
}
FcBool
FcStrRegexCmpIgnoreCase (const FcChar8 *s, const FcChar8 *regex)
{
return _FcStrRegexCmp (s, regex, REG_EXTENDED | REG_NOSUB | REG_ICASE, 0);
}
/*
* Return a hash value for a string
*/