From b97a34b5924b1279dd831426a94016ea8b65ea8d Mon Sep 17 00:00:00 2001 From: Patrick Lam Date: Thu, 24 Nov 2005 19:38:05 +0000 Subject: [PATCH] Inline FcDebug invocations and only initialize once, in FcInit*. Improve debug msg in FcPatternPrint. reviewed by: plam --- ChangeLog | 10 ++++++++++ src/fcdbg.c | 30 ++++++++++++------------------ src/fcinit.c | 2 ++ src/fcint.h | 9 +++++++-- 4 files changed, 31 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index a94de3c..ac81063 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-11-24 Dirk Mueller + reviewed by: plam + + * src/fcdbg.c (FcDebug, FcDebugInit, FcPatternPrint): + * src/fcinit.c (FcInitLoadConfig, FcInitLoadConfigAndFonts): + * src/fcint.h (FcDebug): + + Inline FcDebug invocations and only initialize once, in FcInit*. + Improve debug msg in FcPatternPrint. + 2005-11-23 Frederic Crozat : reviewed by: plam diff --git a/src/fcdbg.c b/src/fcdbg.c index c7e0570..607ddc1 100644 --- a/src/fcdbg.c +++ b/src/fcdbg.c @@ -106,7 +106,7 @@ 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 = FcPatternEltU(p->elts) + i; @@ -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; } diff --git a/src/fcinit.c b/src/fcinit.c index 151c429..3a742a8 100644 --- a/src/fcinit.c +++ b/src/fcinit.c @@ -57,6 +57,7 @@ FcInitLoadConfig (void) { FcConfig *config; + FcInitDebug (); config = FcConfigCreate (); if (!config) return FcFalse; @@ -78,6 +79,7 @@ FcInitLoadConfigAndFonts (void) { FcConfig *config = FcInitLoadConfig (); + FcInitDebug (); if (!config) return 0; if (!FcConfigBuildFonts (config)) diff --git a/src/fcint.h b/src/fcint.h index 4dbb7b4..1b545bc 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -594,8 +594,13 @@ FcEditPrint (const FcEdit *edit); void FcSubstPrint (const FcSubst *subst); -int -FcDebug (void); +extern int FcDebugVal; + +static __inline__ int +FcDebug (void) { return FcDebugVal; } + +void +FcInitDebug (void); /* fcdefault.c */ FcChar8 * -- 2.39.5