[Fontconfig] fontconfig: Branch 'master'

Akira TAGOH tagoh at kemper.freedesktop.org
Sun Jun 29 23:12:37 PDT 2014


 src/fccfg.c |   24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

New commits:
commit dab60e4476ada4ad4639599ea24dd012d4a79584
Author: Akira TAGOH <akira at tagoh.org>
Date:   Mon Jun 30 15:12:32 2014 +0900

    Rework for 5004e8e01f5de30ad01904e57ea0eda006ab3a0c
    
    Don't read/write from/to the XDG dirs even if XDG_*_HOME is set
    and the home directory is disabled.

diff --git a/src/fccfg.c b/src/fccfg.c
index 73c45c8..e2555f0 100644
--- a/src/fccfg.c
+++ b/src/fccfg.c
@@ -2009,17 +2009,15 @@ FcConfigXdgCacheHome (void)
     const char *env = getenv ("XDG_CACHE_HOME");
     FcChar8 *ret = NULL;
 
+    if (!_FcConfigHomeEnabled)
+	return NULL;
     if (env)
 	ret = FcStrCopy ((const FcChar8 *)env);
     else
     {
 	const FcChar8 *home = FcConfigHome ();
-	size_t len;
+	size_t len = home ? strlen ((const char *)home) : 0;
 
-	if (!home)
-	    return NULL;
-
-	len = strlen ((const char *)home);
 	ret = malloc (len + 7 + 1);
 	if (ret)
 	{
@@ -2038,17 +2036,15 @@ FcConfigXdgConfigHome (void)
     const char *env = getenv ("XDG_CONFIG_HOME");
     FcChar8 *ret = NULL;
 
+    if (!_FcConfigHomeEnabled)
+	return NULL;
     if (env)
 	ret = FcStrCopy ((const FcChar8 *)env);
     else
     {
 	const FcChar8 *home = FcConfigHome ();
-	size_t len;
-
-	if (!home)
-	    return NULL;
+	size_t len = home ? strlen ((const char *)home) : 0;
 
-	len = strlen ((const char *)home);
 	ret = malloc (len + 8 + 1);
 	if (ret)
 	{
@@ -2067,17 +2063,15 @@ FcConfigXdgDataHome (void)
     const char *env = getenv ("XDG_DATA_HOME");
     FcChar8 *ret = NULL;
 
+    if (!_FcConfigHomeEnabled)
+	return NULL;
     if (env)
 	ret = FcStrCopy ((const FcChar8 *)env);
     else
     {
 	const FcChar8 *home = FcConfigHome ();
-	size_t len;
-
-	if (!home)
-	    return NULL;
+	size_t len = home ? strlen ((const char *)home) : 0;
 
-	len = strlen ((const char *)home);
 	ret = malloc (len + 13 + 1);
 	if (ret)
 	{


More information about the Fontconfig mailing list