[Fontconfig] fontconfig: Branch 'master' - 2 commits

Akira TAGOH tagoh at kemper.freedesktop.org
Tue Jul 2 02:55:08 PDT 2013


 configure.ac |   50 ++++++++++++++++++++++++++------------------------
 src/fccfg.c  |   27 ++++++++++++++++-----------
 src/fcint.h  |    1 +
 src/fcxml.c  |   37 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 79 insertions(+), 36 deletions(-)

New commits:
commit ab5b535704fbcab43040d80100cb19cb33f6219d
Author: Akira TAGOH <akira at tagoh.org>
Date:   Tue Jul 2 18:54:29 2013 +0900

    Ignore scandir() check on mingw

diff --git a/configure.ac b/configure.ac
index a2b1c72..aeb1513 100644
--- a/configure.ac
+++ b/configure.ac
@@ -161,35 +161,37 @@ AC_LINK_IFELSE([AC_LANG_SOURCE([[
 		AC_MSG_RESULT([yes])
 		AC_DEFINE([HAVE_POSIX_FADVISE], [1], [Define to 1 if you have the 'posix_fadvise' function.])
 	],[AC_MSG_RESULT([no])])
-AC_MSG_CHECKING([for scandir])
-AC_LINK_IFELSE([AC_LANG_SOURCE([[
-	#include <dirent.h>
-	int comp(const struct dirent **, const struct dirent **);
-	int comp(const struct dirent **a, const struct dirent **b) { return 0; }
-	int main(void) {
-	    struct dirent **d;
-	    return scandir(".", &d, 0, &comp) >= 0;
-	}
-	]])],[
-		AC_MSG_RESULT([yes])
-		AC_DEFINE([HAVE_SCANDIR], [1], [Define to 1 if you have the 'scandir' function.])
-	],[
-		AC_LINK_IFELSE([AC_LANG_SOURCE([[
-			#include <dirent.h>
-			int comp(const void *, const void *);
-			int comp(const void *a, const void *b) { return 0; }
-			int main(void) {
-			    struct dirent **d;
-			    return scandir(".", &d, 0, &comp) >= 0;
-			}
+if test "$os_win32" = "no"; then
+	AC_MSG_CHECKING([for scandir])
+	AC_LINK_IFELSE([AC_LANG_SOURCE([[
+		#include <dirent.h>
+		int comp(const struct dirent **, const struct dirent **);
+		int comp(const struct dirent **a, const struct dirent **b) { return 0; }
+		int main(void) {
+		    struct dirent **d;
+		    return scandir(".", &d, 0, &comp) >= 0;
+		}
 		]])],[
 			AC_MSG_RESULT([yes])
-			AC_DEFINE([HAVE_SCANDIR_VOID_P], [1], [Define to 1 if you have the 'scandir' function with int (* compar)(const void *, const void *)])
+			AC_DEFINE([HAVE_SCANDIR], [1], [Define to 1 if you have the 'scandir' function.])
 		],[
-			AC_MSG_ERROR([
+			AC_LINK_IFELSE([AC_LANG_SOURCE([[
+				#include <dirent.h>
+				int comp(const void *, const void *);
+				int comp(const void *a, const void *b) { return 0; }
+				int main(void) {
+				    struct dirent **d;
+				    return scandir(".", &d, 0, &comp) >= 0;
+				}
+			]])],[
+				AC_MSG_RESULT([yes])
+				AC_DEFINE([HAVE_SCANDIR_VOID_P], [1], [Define to 1 if you have the 'scandir' function with int (* compar)(const void *, const void *)])
+			],[
+				AC_MSG_ERROR([
 *** No scandir function available.])
+			])
 		])
-	])
+fi
 CFLAGS="$fc_saved_CFLAGS"
 
 #
commit 0907589a79d05aeed9bc6bff783838b0eb25736b
Author: Akira TAGOH <akira at tagoh.org>
Date:   Fri Jun 28 15:54:38 2013 +0900

    Fix the behavior of intermixed tests end edits in match
    
    to get the following recipe working:
    
    <match>
      <test1 .../>
      <edit1 .../>
      <test2 .../>
      <edit2 .../>
    </match>
    
    as:
    
    <match>
      <test1 .../>
      </edit1 .../>
    </match>
    <match>
      <test1 .../>
      <test2 .../>
      <edit2 .../>
    </match>

diff --git a/src/fccfg.c b/src/fccfg.c
index 9c0be24..3cf31e8 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -226,20 +226,25 @@ FcSubstDestroy (FcSubst *s)
 FcExpr *
 FcConfigAllocExpr (FcConfig *config)
 {
-  if (!config->expr_pool || config->expr_pool->next == config->expr_pool->end)
-  {
-    FcExprPage *new_page;
+    FcExpr *e;
 
-    new_page = malloc (sizeof (FcExprPage));
-    if (!new_page)
-      return 0;
+    if (!config->expr_pool || config->expr_pool->next == config->expr_pool->end)
+    {
+	FcExprPage *new_page;
 
-    new_page->next_page = config->expr_pool;
-    new_page->next = new_page->exprs;
-    config->expr_pool = new_page;
-  }
+	new_page = malloc (sizeof (FcExprPage));
+	if (!new_page)
+	    return 0;
+
+	new_page->next_page = config->expr_pool;
+	new_page->next = new_page->exprs;
+	config->expr_pool = new_page;
+    }
+
+    e = config->expr_pool->next++;
+    FcRefInit (&e->ref, 1);
 
-  return config->expr_pool->next++;
+    return e;
 }
 
 FcConfig *
diff --git a/src/fcint.h b/src/fcint.h
index 0137dee..92777ea 100644
--- a/src/fcint.h
+++ b/src/fcint.h
@@ -240,6 +240,7 @@ typedef struct _FcExprName {
 
 typedef struct _FcExpr {
     FcOp   op;
+    FcRef  ref;
     union {
 	int	    ival;
 	double	    dval;
diff --git a/src/fcxml.c b/src/fcxml.c
index 7e03230..4b8049f 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -223,11 +223,24 @@ FcExprCreateOp (FcConfig *config, FcExpr *left, FcOp op, FcExpr *right)
     return e;
 }
 
+static FcExpr *
+FcExprReference (FcExpr *e)
+{
+    if (e)
+    {
+	FcRefInc (&e->ref);
+    }
+
+    return e;
+}
+
 static void
 FcExprDestroy (FcExpr *e)
 {
     if (!e)
 	return;
+    if (FcRefDec (&e->ref) != 1)
+	return;
     switch (FC_OP_GET_OP (e->op)) {
     case FcOpInteger:
 	break;
@@ -727,6 +740,21 @@ FcTestCreate (FcConfigParse *parse,
     return test;
 }
 
+static FcTest *
+FcTestDuplicate (FcTest *test)
+{
+    FcTest *retval = (FcTest *) malloc (sizeof (FcTest));
+
+    if (retval)
+    {
+	memcpy (retval, test, sizeof (FcTest));
+	retval->next = NULL;
+	retval->expr = FcExprReference (test->expr);
+    }
+
+    return retval;
+}
+
 static FcEdit *
 FcEditCreate (FcConfigParse	*parse,
 	      FcObject		object,
@@ -2401,7 +2429,7 @@ FcParseMatch (FcConfigParse *parse)
     FcVStack	    *vstack;
     FcBool           tested = FcFalse;
     FcSubstStack    *sstack = NULL;
-    int              len, pos = 0;
+    int              len, pos = 0, i;
 
     kind_name = FcConfigGetAttribute (parse, "target");
     if (!kind_name)
@@ -2438,6 +2466,13 @@ FcParseMatch (FcConfigParse *parse)
 	    test = vstack->u.test;
 	    vstack->tag = FcVStackNone;
 	    tested = FcTrue;
+	    for (i = 0; i < pos; i++)
+	    {
+		FcTest *t = FcTestDuplicate(test);
+
+		t->next = sstack[i].test;
+		sstack[i].test = t;
+	    }
 	    break;
 	case FcVStackEdit:
 	    /* due to the reverse traversal, <edit> node appears faster than


More information about the Fontconfig mailing list