[Fontconfig] fontconfig: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Jan 1 23:31:53 PST 2013


 src/fcxml.c |   19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

New commits:
commit 6047ce7b9fb793da4e693e3777bbd3e1baf3146e
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Wed Jan 2 01:31:34 2013 -0600

    Warn about undefined/invalid attributes during config parsing

diff --git a/src/fcxml.c b/src/fcxml.c
index 8c934f5..1963cba 100644
--- a/src/fcxml.c
+++ b/src/fcxml.c
@@ -1092,10 +1092,26 @@ FcPStackPop (FcConfigParse *parse)
 	FcConfigMessage (parse, FcSevereError, "mismatching element");
 	return FcFalse;
     }
+
+    if (parse->pstack->attr)
+    {
+	/* Warn about unused attrs. */
+	FcChar8 **attrs = parse->pstack->attr;
+	while (*attrs)
+	{
+	    if (attrs[0][0])
+	    {
+		FcConfigMessage (parse, FcSevereError, "invalid attribute '%s'", attrs[0]);
+	    }
+	    attrs += 2;
+	}
+    }
+
     FcVStackClear (parse);
     old = parse->pstack;
     parse->pstack = old->prev;
     FcStrBufDestroy (&old->str);
+
     if (old->attr && old->attr != old->attr_buf_static)
 	free (old->attr);
 
@@ -1141,7 +1157,10 @@ FcConfigGetAttribute (FcConfigParse *parse, const char *attr)
     while (*attrs)
     {
 	if (!strcmp ((char *) *attrs, attr))
+	{
+	    attrs[0][0] = '\0'; /* Mark as used. */
 	    return attrs[1];
+	}
 	attrs += 2;
     }
     return 0;


More information about the Fontconfig mailing list