summaryrefslogtreecommitdiff
path: root/fc-cache
diff options
context:
space:
mode:
authorPatrick Lam <plam@MIT.EDU>2005-07-25 04:10:09 +0000
committerPatrick Lam <plam@MIT.EDU>2005-07-25 04:10:09 +0000
commit212c9f437e959fbdc5fe344c67b8c1cf8ca63edb (patch)
treea5a82c8017ff6461dd8bdb4bb3e218af91b22ee6 /fc-cache
parente1b9d091c661b0e1d1e9f73c5c55ad53959c55c7 (diff)
#ifdef out old cache stuff, replace with first version of new mmapping
cache. Add *Read and *Write procedures which mmap in and write out the fontconfig data structures to disk. Currently, create cache in /tmp, with different sections for each architecture (as returned by uname's .machine field. Run the fc-cache binary to create a new cache file; fontconfig then uses this cache file on subsequent runs, saving lots of memory. Also fixes a few bugs and leaks.
Diffstat (limited to 'fc-cache')
-rw-r--r--fc-cache/fc-cache.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 1e8fdf2..7d01ccf 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -93,6 +93,7 @@ usage (char *program)
exit (1);
}
+#if 0
static int
nsubdirs (FcStrSet *set)
{
@@ -222,6 +223,7 @@ scanDirs (FcStrList *list, FcConfig *config, char *program, FcBool force, FcBool
FcStrListDone (list);
return ret;
}
+#endif
int
main (int argc, char **argv)
@@ -268,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 ();
@@ -298,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