]> git.wh0rd.org - fontconfig.git/blobdiff - src/fccache.c
Document skipping of fonts from FcFileScan/FcDirScan.
[fontconfig.git] / src / fccache.c
index 42c70821748819cd7dbcdd932aed2c1884d24907..bd8db460d60513170a45d5a907813b1ef99d0d0e 100644 (file)
@@ -454,7 +454,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
     if (cache)
        return cache;
     /*
-     * For small cache files, just read them into memory
+     * Lage cache files are mmap'ed, smaller cache files are read. This
+     * balances the system cost of mmap against per-process memory usage.
      */
     if (fd_stat->st_size >= FC_CACHE_MIN_MMAP)
     {
@@ -492,8 +493,8 @@ FcDirCacheMapFd (int fd, struct stat *fd_stat, struct stat *dir_stat)
     if (cache->magic != FC_CACHE_MAGIC_MMAP || 
        cache->version < FC_CACHE_CONTENT_VERSION ||
        cache->size != fd_stat->st_size ||
-       !FcCacheInsert (cache, fd_stat) ||
-       !FcCacheTimeValid (cache, dir_stat))
+       !FcCacheTimeValid (cache, dir_stat) ||
+       !FcCacheInsert (cache, fd_stat))
     {
        if (allocated)
            free (cache);
@@ -726,7 +727,7 @@ FcMakeDirectory (const FcChar8 *dir)
     parent = FcStrDirname (dir);
     if (!parent)
        return FcFalse;
-    if (access ((char *) parent, W_OK|X_OK) == 0)
+    if (access ((char *) parent, F_OK) == 0)
        ret = mkdir ((char *) dir, 0777) == 0;
     else if (access ((char *) parent, F_OK) == -1)
        ret = FcMakeDirectory (parent) && (mkdir ((char *) dir, 0777) == 0);
@@ -759,7 +760,7 @@ FcDirCacheWrite (FcCache *cache, FcConfig *config)
     if (!list)
        return FcFalse;
     while ((test_dir = FcStrListNext (list))) {
-       if (access ((char *) test_dir, W_OK|X_OK) == 0)
+       if (access ((char *) test_dir, W_OK) == 0)
        {
            cache_dir = test_dir;
            break;