]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccfg.c
Add better error reporting when loading config file
[fontconfig.git] / src / fccfg.c
index 715f09170fdd57dd220214d8b92ed7990843c7c0..91373d39da3fc584df96b34d0bcf3d3172c3edba 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $XFree86: $
+ * $XFree86: xc/lib/fontconfig/src/fccfg.c,v 1.3 2002/02/19 08:33:23 keithp Exp $
  *
  * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc.
  *
@@ -27,7 +27,7 @@
 #include <stdio.h>
 #include "fcint.h"
 
-static FcConfig    *fcConfig;
+FcConfig    *_fcConfig;
 
 FcConfig *
 FcConfigCreate (void)
@@ -186,16 +186,19 @@ FcConfigSetCurrent (FcConfig *config)
        if (!FcConfigBuildFonts (config))
            return FcFalse;
 
-    if (fcConfig)
-       FcConfigDestroy (fcConfig);
-    fcConfig = config;
+    if (_fcConfig)
+       FcConfigDestroy (_fcConfig);
+    _fcConfig = config;
     return FcTrue;
 }
 
 FcConfig *
 FcConfigGetCurrent (void)
 {
-    return fcConfig;
+    if (!_fcConfig)
+       if (!FcInit ())
+           return 0;
+    return _fcConfig;
 }
 
 FcBool
@@ -846,7 +849,7 @@ FcConfigValues (FcPattern *p, FcExpr *e)
        l->value = FcConfigEvaluate (p, e);
        l->next  = 0;
     }
-    while (l->value.type == FcTypeVoid)
+    while (l && l->value.type == FcTypeVoid)
     {
        FcValueList     *next = l->next;