From 874a5491641642f669396c514c3672f6794fdfa7 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 24 Jul 2014 15:42:54 -0400 Subject: [PATCH] Remove unused regex code Regex matching was disabled in f6244d2cf231e1dc756f3e941e61b9bf124879bb --- configure.ac | 10 ++-------- src/fcint.h | 6 ------ src/fcstr.c | 52 ---------------------------------------------------- 3 files changed, 2 insertions(+), 66 deletions(-) diff --git a/configure.ac b/configure.ac index ce468b8..a366853 100644 --- a/configure.ac +++ b/configure.ac @@ -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 ]) -# -# 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 diff --git a/src/fcint.h b/src/fcint.h index d3079ed..45dfc6e 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -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); diff --git a/src/fcstr.c b/src/fcstr.c index 024dae3..29a577d 100644 --- a/src/fcstr.c +++ b/src/fcstr.c @@ -26,9 +26,6 @@ #include #include #include -#ifdef HAVE_REGEX_H -#include -#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 (®, (const char *)regex, cflags)) != 0) - { - if (FcDebug () & FC_DBG_MATCHV) - { - char buf[512]; - - regerror (ret, ®, buf, 512); - printf("Regexp compile error: %s\n", buf); - } - return FcFalse; - } - ret = regexec (®, (const char *)s, 0, NULL, eflags); - if (ret != 0) - { - if (FcDebug () & FC_DBG_MATCHV) - { - char buf[512]; - - regerror (ret, ®, buf, 512); - printf("Regexp exec error: %s\n", buf); - } - } - regfree (®); - - 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 */