configure.in | 9 +++++++++
src/fcstr.c | 6 ++++--
2 files changed, 13 insertions(+), 2 deletions(-)
New commits:
commit ac6271dbac32086ce60845efc4d87e669f37796a
Author: Akira TAGOH <akira at tagoh.org>
Date: Thu Apr 12 11:01:12 2012 +0900
Bug 48573 - platform without regex do not have also REG_XXX defines
Fix a build issue on the platforms where regex isn''t available
diff --git a/configure.in b/configure.in
index 39ae5a9..3f5c98b 100644
--- a/configure.in
+++ b/configure.in
@@ -136,6 +136,15 @@ AC_FUNC_MMAP
AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr
strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r
rand_r regcomp regerror regexec regfree])
#
+# regex
+#
+use_regex=0
+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
+ use_regex=1
+fi
+AC_DEFINE_UNQUOTED(USE_REGEX,$use_regex,[Use regex.])
+
+#
# Checks for iconv
#
AC_ARG_WITH(libiconv,
diff --git a/src/fcstr.c b/src/fcstr.c
index 9484d46..a6f0ba7 100644
--- a/src/fcstr.c
+++ b/src/fcstr.c
@@ -272,11 +272,11 @@ 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;
-#if defined (HAVE_REGCOMP) && defined (HAVE_REGERROR) &&
defined (HAVE_REGEXEC) && defined (HAVE_REGFREE)
regex_t reg;
if ((ret = regcomp (®, (const char *)regex, cflags)) != 0)
@@ -302,10 +302,12 @@ _FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex,
int cflags, int eflags)
}
}
regfree (®);
-#endif
return ret == 0 ? FcTrue : FcFalse;
}
+#else
+# define _FcStrRegexCmp(_s_, _regex_) (FcFalse)
+#endif
FcBool
FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex)
On 12/04/2012 03:01, Akira TAGOH wrote:> configure.in | 9 +++++++++ > src/fcstr.c | 6 ++++-- > 2 files changed, 13 insertions(+), 2 deletions(-) > > New commits: > commit ac6271dbac32086ce60845efc4d87e669f37796a > Author: Akira TAGOH <akira at tagoh.org> > Date: Thu Apr 12 11:01:12 2012 +0900 > > Bug 48573 - platform without regex do not have also REG_XXX defines > > Fix a build issue on the platforms where regex isn''t availableI came across a couple of issues building for mingw after this change. Patch attached.> diff --git a/configure.in b/configure.in > index 39ae5a9..3f5c98b 100644 > --- a/configure.in > +++ b/configure.in > @@ -136,6 +136,15 @@ AC_FUNC_MMAP > AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr strtol getopt getopt_long sysconf ftruncate chsize rand random lrand48 random_r rand_r regcomp regerror regexec regfree]) > > # > +# regex > +# > +use_regex=0 > +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 > + use_regex=1 > +fi > +AC_DEFINE_UNQUOTED(USE_REGEX,$use_regex,[Use regex.]) > + > +# > # Checks for iconv > # > AC_ARG_WITH(libiconv, > diff --git a/src/fcstr.c b/src/fcstr.c > index 9484d46..a6f0ba7 100644 > --- a/src/fcstr.c > +++ b/src/fcstr.c > @@ -272,11 +272,11 @@ FcStrCmp (const FcChar8 *s1, const FcChar8 *s2) > return (int) c1 - (int) c2; > } > > +#ifdef USE_REGEXUSE_REGEX is always defined, we should check it''s value here.> static FcBool > _FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags) > { > int ret = -1; > -#if defined (HAVE_REGCOMP) && defined (HAVE_REGERROR) && defined (HAVE_REGEXEC) && defined (HAVE_REGFREE) > regex_t reg; > > if ((ret = regcomp (®, (const char *)regex, cflags)) != 0) > @@ -302,10 +302,12 @@ _FcStrRegexCmp (const FcChar8 *s, const FcChar8 *regex, int cflags, int eflags) > } > } > regfree (®); > -#endif > > return ret == 0 ? FcTrue : FcFalse; > } > +#else > +# define _FcStrRegexCmp(_s_, _regex_) (FcFalse) > +#endifThis macro has fewer arguments than the function
On Fri, Apr 20, 2012 at 7:09 PM, Jon TURNEY <jon.turney at dronecode.org.uk> wrote:> USE_REGEX is always defined, we should check it''s value here.my bad. though I''d prefer to define it as needed. -- Akira TAGOH