X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=fc-cache%2Ffc-cache.c;h=98039f77ff778aaa1fd583bf5e066b42c195b0bf;hb=bb8057ea77ec89e789afbc6e87b7a16d479d3105;hp=d2653507eff17f2b7e7348ca7f4bf6e29e1f789f;hpb=18b8be363ca19666d8e90f8fc124c5b5e9ec15dc;p=fontconfig.git diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index d265350..98039f7 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -253,24 +253,16 @@ 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) @@ -279,7 +271,6 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose) if (!d) { perror ((char *) dir); - FcStrFree (dir_base); return FcFalse; } while ((ent = readdir (d))) @@ -295,7 +286,7 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose) strcmp(ent->d_name + 32, "-" FC_ARCHITECTURE FC_CACHE_SUFFIX)) continue; - file_name = FcStrPlus (dir_base, (FcChar8 *) ent->d_name); + file_name = FcStrPathPlus (dir, (const FcChar8 *) ent->d_name, NULL); if (!file_name) { fprintf (stderr, "%s: allocation failure\n", dir); @@ -334,7 +325,6 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose) } closedir (d); - FcStrFree (dir_base); return ret; }