]> git.wh0rd.org - fontconfig.git/commitdiff
Add a couple of missing normalizations to make fc-cache work right; only
authorPatrick Lam <plam@MIT.EDU>
Fri, 27 Jan 2006 00:27:37 +0000 (00:27 +0000)
committerPatrick Lam <plam@MIT.EDU>
Fri, 27 Jan 2006 00:27:37 +0000 (00:27 +0000)
    scan subdirectories once.

ChangeLog
src/fccache.c
src/fccfg.c

index 32f20e40eb638fd1f7180225154058e01054786f..e85113bc900b67f99e45f90c37cf7a1c04fc27a8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2006-01-26  Patrick Lam  <plam@mit.edu>
+       * src/fccache.c (FcDirCacheValid, FcDirCacheHasCurrentArch):
+       * src/fccfg.c (FcConfigNormalizeFontDir):
+
+       Add a couple of missing normalizations to make fc-cache work
+       right; only scan subdirectories once.
+
 2006-01-26  Mike Fabian  <mfabian@suse.de>
        reviewed by: plam
        
index a687483bc9fdcdca1630d9433e8cbc75112ff2dc..84915515d528427f216c07ed9c8c6869964cb811 100644 (file)
@@ -609,6 +609,10 @@ FcDirCacheValid (const FcChar8 *dir)
     struct stat file_stat, dir_stat;
     int        fd;
 
+    dir = FcConfigNormalizeFontDir (FcConfigGetCurrent(), dir);
+    if (!dir)
+       return FcFalse;
+
     if (stat ((char *) dir, &dir_stat) < 0)
         return FcFalse;
 
@@ -644,6 +648,10 @@ FcDirCacheHasCurrentArch (const FcChar8 *dir)
     off_t      current_arch_start;
     char       *current_arch_machine_name;
 
+    dir = FcConfigNormalizeFontDir (FcConfigGetCurrent(), dir);
+    if (!dir)
+       return FcFalse;
+
     fd = FcDirCacheOpen (dir);
     if (fd < 0)
        goto bail;
index 6e5174b505df51090ea4d8c5deae6b12eff6f3f9..c533006ace2829feb1e6ec990009992774c4265c 100644 (file)
@@ -432,7 +432,7 @@ FcConfigNormalizeFontDir (FcConfig          *config,
     /* If this is a bottleneck, we can cache the fontDir inodes. */
     ino_t      di;
     dev_t      dd;
-    int                n;
+    int                n, n0;
     struct stat s;
 
     if (stat ((char *)d, &s) == -1)
@@ -448,7 +448,7 @@ FcConfigNormalizeFontDir (FcConfig          *config,
     }
 
     /* Ok, we didn't find it in fontDirs; let's add subdirs.... */
-    for (n = 0; n < config->fontDirs->num; n++)
+    for (n = 0, n0 = config->fontDirs->num; n < n0; n++)
        FcConfigAddFontDirSubdirs (config, config->fontDirs->strs[n]);
 
     /* ... and try again. */