]> git.wh0rd.org - fontconfig.git/blobdiff - src/fcdbg.c
Inline FcDebug invocations and only initialize once, in FcInit*. Improve
[fontconfig.git] / src / fcdbg.c
index cd72edad8f8cb41345ed2fa3aa0ebfcc5bebd581..607ddc1e46fc916759df50b4fc4801a367ed576b 100644 (file)
@@ -62,12 +62,12 @@ FcValuePrint (const FcValue v)
 }
 
 void
-FcValueListPrint (const FcValueList *l)
+FcValueListPrint (FcValueListPtr l)
 {
-    for (; l; l = l->next)
+    for (; FcValueListPtrU(l); l = FcValueListPtrU(l)->next)
     {
-       FcValuePrint (l->value);
-       switch (l->binding) {
+       FcValuePrint (FcValueCanonicalize(&FcValueListPtrU(l)->value));
+       switch (FcValueListPtrU(l)->binding) {
        case FcValueBindingWeak:
            printf ("(w)");
            break;
@@ -89,9 +89,9 @@ FcLangSetPrint (const FcLangSet *ls)
     
     FcStrBufInit (&buf, init_buf, sizeof (init_buf));
     if (FcNameUnparseLangSet (&buf, ls) && FcStrBufChar (&buf,'\0'))
-       printf ("%s", buf.buf);
+       printf ("%s", buf.buf);
     else
-       printf ("langset (alloc error)");
+       printf ("langset (alloc error)");
     FcStrBufDestroy (&buf);
 }
 
@@ -106,11 +106,11 @@ FcPatternPrint (const FcPattern *p)
        printf ("Null pattern\n");
        return;
     }
-    printf ("Pattern %d of %d\n", p->num, p->size);
+    printf ("Pattern has %d elts (size %d)\n", p->num, p->size);
     for (i = 0; i < p->num; i++)
     {
-       e = &p->elts[i];
-       printf ("\t%s:", e->object);
+       e = FcPatternEltU(p->elts) + i;
+       printf ("\t%s:", FcObjectPtrU(e->object));
        FcValueListPrint (e->values);
        printf ("\n");
     }
@@ -339,25 +339,19 @@ FcFontSetPrint (const FcFontSet *s)
     }
 }
 
-int
-FcDebug (void)
+int FcDebugVal;
+
+void
+FcInitDebug (void)
 {
-    static int  initialized;
-    static int  debug;
+    char    *e;
 
-    if (!initialized)
+    e = getenv ("FC_DEBUG");
+    if (e)
     {
-       char    *e;
-
-       initialized = 1;
-       e = getenv ("FC_DEBUG");
-       if (e)
-       {
-           printf ("FC_DEBUG=%s\n", e);
-           debug = atoi (e);
-           if (debug < 0)
-               debug = 0;
-       }
+        printf ("FC_DEBUG=%s\n", e);
+        FcDebugVal = atoi (e);
+        if (FcDebugVal < 0)
+           FcDebugVal = 0;
     }
-    return debug;
 }