]> git.wh0rd.org - fontconfig.git/blobdiff - fc-cache/fc-cache.c
#ifdef out old cache stuff, replace with first version of new mmapping
[fontconfig.git] / fc-cache / fc-cache.c
index 6fa0c5a9cfcf40d0bcb411d8113f21a709790f6e..7d01ccf9997f2490e4469fbfd9198be1d07cbca3 100644 (file)
@@ -93,6 +93,7 @@ usage (char *program)
     exit (1);
 }
 
+#if 0
 static int
 nsubdirs (FcStrSet *set)
 {
@@ -141,6 +142,7 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
        {
            fprintf (stderr, "Can't create directory set\n");
            ret++;
+           FcFontSetDestroy (set);
            continue;
        }
        
@@ -162,23 +164,31 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
                perror ("");
                ret++;
            }
+           FcFontSetDestroy (set);
+           FcStrSetDestroy (subdirs);
            continue;
        }
        if (stat ((char *) dir, &statb) == -1)
        {
            fprintf (stderr, "\"%s\": ", dir);
            perror ("");
+           FcFontSetDestroy (set);
+           FcStrSetDestroy (subdirs);
            ret++;
            continue;
        }
        if (!S_ISDIR (statb.st_mode))
        {
            fprintf (stderr, "\"%s\": not a directory, skipping\n", dir);
+           FcFontSetDestroy (set);
+           FcStrSetDestroy (subdirs);
            continue;
        }
        if (!FcDirScan (set, subdirs, 0, FcConfigGetBlanks (config), dir, force))
        {
            fprintf (stderr, "\"%s\": error scanning\n", dir);
+           FcFontSetDestroy (set);
+           FcStrSetDestroy (subdirs);
            ret++;
            continue;
        }
@@ -201,6 +211,7 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
        }
        FcFontSetDestroy (set);
        sublist = FcStrListCreate (subdirs);
+       FcStrSetDestroy (subdirs);
        if (!sublist)
        {
            fprintf (stderr, "Can't create subdir list in \"%s\"\n", dir);
@@ -208,11 +219,11 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
            continue;
        }
        ret += scanDirs (sublist, config, program, force, verbose);
-       FcStrSetDestroy (subdirs);
     }
     FcStrListDone (list);
     return ret;
 }
+#endif
 
 int
 main (int argc, char **argv)
@@ -259,12 +270,20 @@ main (int argc, char **argv)
 
     if (systemOnly)
        FcConfigEnableHome (FcFalse);
-    config = FcInitLoadConfig ();
+    FcCacheForce (FcTrue);
+    /* need to use FcInitLoadConfig when we use dirs */
+    FcInit ();
+    config = FcConfigGetCurrent ();
     if (!config)
     {
        fprintf (stderr, "%s: Can't init font config library\n", argv[0]);
        return 1;
     }
+
+    /* We don't yet have per-directory caches. */
+    ret = (FcCacheWrite (config) == FcFalse);
+
+#if 0
     if (argv[i])
     {
        dirs = FcStrSetCreate ();
@@ -289,6 +308,7 @@ main (int argc, char **argv)
     else
        list = FcConfigGetConfigDirs (config);
     ret = scanDirs (list, config, argv[0], force, verbose);
+#endif
     /* 
      * Now we need to sleep a second  (or two, to be extra sure), to make
      * sure that timestamps for changes after this run of fc-cache are later