]> git.wh0rd.org - fontconfig.git/blobdiff - fc-match/fc-match.c
Skip broken caches. Cache files are auto-written, don't rewrite in fc-cache.
[fontconfig.git] / fc-match / fc-match.c
index 2666620a5c1116b3471fcd694d9aa6274a913d93..5f36f004fd0abeca1e97982e0a9d4ac038b60ecf 100644 (file)
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-#include <fontconfig/fontconfig.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <stdlib.h>
-#include <string.h>
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #else
 #define HAVE_GETOPT 1
 #endif
 
+#include <fontconfig/fontconfig.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
 #ifndef HAVE_GETOPT
 #define HAVE_GETOPT 0
 #endif
@@ -134,6 +135,9 @@ main (int argc, char **argv)
     else
        pat = FcPatternCreate ();
 
+    if (!pat)
+       return 1;
+
     FcConfigSubstitute (0, pat, FcMatchPattern);
     FcDefaultSubstitute (pat);
     
@@ -147,8 +151,7 @@ main (int argc, char **argv)
        if (match)
            FcFontSetAdd (fs, match);
     }
-    if (pat)
-       FcPatternDestroy (pat);
+    FcPatternDestroy (pat);
 
     if (fs)
     {
@@ -184,5 +187,6 @@ main (int argc, char **argv)
        }
        FcFontSetDestroy (fs);
     }
+    FcFini ();
     return 0;
 }