aboutsummaryrefslogtreecommitdiff
path: root/fontconfig/fc-cache
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-04-20 17:07:15 +0200
committermarha <marha@users.sourceforge.net>2012-04-20 17:07:15 +0200
commit0e3699334faf92f508b6c187a261548b656b0dd3 (patch)
tree28d7e84df7b54a3e6f85bf83e38efba937288fd3 /fontconfig/fc-cache
parentc1194ccd395fdbb23c9ab56bc340ee20a5feeb82 (diff)
downloadvcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.gz
vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.tar.bz2
vcxsrv-0e3699334faf92f508b6c187a261548b656b0dd3.zip
fontconfig libX11 mesa pixman xserver git update 20 april 2012
Diffstat (limited to 'fontconfig/fc-cache')
-rw-r--r--fontconfig/fc-cache/fc-cache.c93
1 files changed, 1 insertions, 92 deletions
diff --git a/fontconfig/fc-cache/fc-cache.c b/fontconfig/fc-cache/fc-cache.c
index 24bb2ec9f..b42fd3545 100644
--- a/fontconfig/fc-cache/fc-cache.c
+++ b/fontconfig/fc-cache/fc-cache.c
@@ -32,7 +32,6 @@
#endif
#include <fontconfig/fontconfig.h>
-#include "../src/fcarch.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -319,96 +318,6 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
}
static FcBool
-cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose)
-{
- DIR *d;
- struct dirent *ent;
- FcChar8 *dir_base;
- FcBool ret = FcTrue;
- FcBool remove;
- FcCache *cache;
- struct stat target_stat;
-
- dir_base = FcStrPlus (dir, (FcChar8 *) "/");
- if (!dir_base)
- {
- fprintf (stderr, "%s: out of memory\n", dir);
- return FcFalse;
- }
- if (access ((char *) dir, W_OK) != 0)
- {
- if (verbose)
- printf ("%s: not cleaning %s cache directory\n", dir,
- access ((char *) dir, F_OK) == 0 ? "unwritable" : "non-existent");
- FcStrFree (dir_base);
- return FcTrue;
- }
- if (verbose)
- printf ("%s: cleaning cache directory\n", dir);
- d = opendir ((char *) dir);
- if (!d)
- {
- perror ((char *) dir);
- FcStrFree (dir_base);
- return FcFalse;
- }
- while ((ent = readdir (d)))
- {
- FcChar8 *file_name;
- const FcChar8 *target_dir;
-
- if (ent->d_name[0] == '.')
- continue;
- /* skip cache files for different architectures and */
- /* files which are not cache files at all */
- if (strlen(ent->d_name) != 32 + strlen ("-" FC_ARCHITECTURE FC_CACHE_SUFFIX) ||
- strcmp(ent->d_name + 32, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX))
- continue;
-
- file_name = FcStrPlus (dir_base, (FcChar8 *) ent->d_name);
- if (!file_name)
- {
- fprintf (stderr, "%s: allocation failure\n", dir);
- ret = FcFalse;
- break;
- }
- remove = FcFalse;
- cache = FcDirCacheLoadFile (file_name, NULL);
- if (!cache)
- {
- if (verbose)
- printf ("%s: invalid cache file: %s\n", dir, ent->d_name);
- remove = FcTrue;
- }
- else
- {
- target_dir = FcCacheDir (cache);
- if (stat ((char *) target_dir, &target_stat) < 0)
- {
- if (verbose)
- printf ("%s: %s: missing directory: %s \n",
- dir, ent->d_name, target_dir);
- remove = FcTrue;
- }
- }
- if (remove)
- {
- if (unlink ((char *) file_name) < 0)
- {
- perror ((char *) file_name);
- ret = FcFalse;
- }
- }
- FcDirCacheUnload (cache);
- FcStrFree (file_name);
- }
-
- closedir (d);
- FcStrFree (dir_base);
- return ret;
-}
-
-static FcBool
cleanCacheDirectories (FcConfig *config, FcBool verbose)
{
FcStrList *cache_dirs = FcConfigGetCacheDirs (config);
@@ -419,7 +328,7 @@ cleanCacheDirectories (FcConfig *config, FcBool verbose)
return FcFalse;
while ((cache_dir = FcStrListNext (cache_dirs)))
{
- if (!cleanCacheDirectory (config, cache_dir, verbose))
+ if (!FcDirCacheClean (cache_dir, verbose))
{
ret = FcFalse;
break;