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

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Nov 27 09:37:47 UTC 2018


 fc-cache/fc-cache.c |   17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

New commits:
commit 3c75a5a9358ae570230c324917a636947748eb1f
Author: Chris McDonald <cjmcdonald at chromium.org>
Date:   Mon Nov 26 11:46:21 2018 -0700

    Lowered temporary rooted_dir variable inside loop

diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 61dd57d..71cb61f 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -142,7 +142,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
     FcBool	    was_valid, was_processed = FcFalse;
     int		    i;
     const FcChar8   *sysroot = FcConfigGetSysRoot (config);
-	FcChar8 *rooted_dir = NULL;
 
     /*
      * Now scan all of the directories into separate databases
@@ -158,20 +157,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	    fflush (stdout);
 	}
 
-	if (rooted_dir)
-	{
-		FcStrFree(rooted_dir);
-		rooted_dir = NULL;
-	}
-	
-	if (sysroot)
-	{
-		rooted_dir = FcStrPlus(sysroot, dir);
-	}
-	else {
-		rooted_dir = FcStrCopy(dir);
-	}
-
 	if (FcStrSetMember (processed_dirs, dir))
 	{
 	    if (verbose)
@@ -179,6 +164,15 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	    continue;
 	}
 
+    FcChar8 *rooted_dir = NULL;
+    if (sysroot)
+    {
+        rooted_dir = FcStrPlus(sysroot, dir);
+    }
+    else {
+        rooted_dir = FcStrCopy(dir);
+    }
+
 	if (stat ((char *) rooted_dir, &statb) == -1)
 	{
 	    switch (errno) {
@@ -196,6 +190,9 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	    continue;
 	}
 
+    FcStrFree(rooted_dir);
+    rooted_dir = NULL;
+
 	if (!S_ISDIR (statb.st_mode))
 	{
 	    fprintf (stderr, _("\"%s\": not a directory, skipping\n"), dir);
@@ -275,10 +272,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	FcStrListDone (sublist);
     }
 
-	if (rooted_dir)
-	{
-		FcStrFree(rooted_dir);
-	}
     if (error_on_no_fonts && !was_processed)
 	ret++;
     return ret;
commit d36f977c761ffbb75d5c76278bc14d1c0e74cc7a
Author: Chris McDonald <cjmcdonald at chromium.org>
Date:   Mon Nov 19 15:19:19 2018 -0700

    Respect sysroot option for file path passed to stat

diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 87e3020..61dd57d 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -142,6 +142,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
     FcBool	    was_valid, was_processed = FcFalse;
     int		    i;
     const FcChar8   *sysroot = FcConfigGetSysRoot (config);
+	FcChar8 *rooted_dir = NULL;
 
     /*
      * Now scan all of the directories into separate databases
@@ -156,7 +157,21 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	    printf ("%s: ", dir);
 	    fflush (stdout);
 	}
+
+	if (rooted_dir)
+	{
+		FcStrFree(rooted_dir);
+		rooted_dir = NULL;
+	}
 	
+	if (sysroot)
+	{
+		rooted_dir = FcStrPlus(sysroot, dir);
+	}
+	else {
+		rooted_dir = FcStrCopy(dir);
+	}
+
 	if (FcStrSetMember (processed_dirs, dir))
 	{
 	    if (verbose)
@@ -164,7 +179,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	    continue;
 	}
 
-	if (stat ((char *) dir, &statb) == -1)
+	if (stat ((char *) rooted_dir, &statb) == -1)
 	{
 	    switch (errno) {
 	    case ENOENT:
@@ -259,6 +274,11 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	ret += scanDirs (sublist, config, force, really_force, verbose, error_on_no_fonts, changed);
 	FcStrListDone (sublist);
     }
+
+	if (rooted_dir)
+	{
+		FcStrFree(rooted_dir);
+	}
     if (error_on_no_fonts && !was_processed)
 	ret++;
     return ret;


More information about the Fontconfig mailing list