parent
9a8e812477
commit
874a549164
10
configure.ac
10
configure.ac
|
@ -138,7 +138,7 @@ dnl ==========================================================================
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_DIRENT
|
AC_HEADER_DIRENT
|
||||||
AC_HEADER_STDC
|
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])
|
AX_CREATE_STDINT_H([src/fcstdint.h])
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
|
@ -150,7 +150,7 @@ AC_TYPE_PID_T
|
||||||
# Checks for library functions.
|
# Checks for library functions.
|
||||||
AC_FUNC_VPRINTF
|
AC_FUNC_VPRINTF
|
||||||
AC_FUNC_MMAP
|
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 AC_CHECK_FUNCS doesn't check for header files.
|
||||||
dnl posix_fadvise() may be not available in older libc.
|
dnl posix_fadvise() may be not available in older libc.
|
||||||
|
@ -211,12 +211,6 @@ if test "x$ac_cv_func_fstatfs" = "xyes"; then
|
||||||
fi
|
fi
|
||||||
AC_CHECK_MEMBERS([struct dirent.d_type],,,
|
AC_CHECK_MEMBERS([struct dirent.d_type],,,
|
||||||
[#include <dirent.h>])
|
[#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
|
# Checks for iconv
|
||||||
|
|
|
@ -1152,12 +1152,6 @@ FcStrCmpIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
|
||||||
FcPrivate int
|
FcPrivate int
|
||||||
FcStrCmpIgnoreCaseAndDelims (const FcChar8 *s1, const FcChar8 *s2, const FcChar8 *delims);
|
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 *
|
FcPrivate const FcChar8 *
|
||||||
FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
|
FcStrContainsIgnoreBlanksAndCase (const FcChar8 *s1, const FcChar8 *s2);
|
||||||
|
|
||||||
|
|
52
src/fcstr.c
52
src/fcstr.c
|
@ -26,9 +26,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#ifdef HAVE_REGEX_H
|
|
||||||
#include <regex.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Objects MT-safe for readonly access. */
|
/* Objects MT-safe for readonly access. */
|
||||||
|
@ -242,55 +239,6 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2)
|
||||||
return (int) c1 - (int) c2;
|
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
|
* Return a hash value for a string
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue