[Fontconfig] [PATCH 2/3] FcStat: export for people to use

Mike Frysinger vapier at gentoo.org
Mon Nov 7 21:25:00 PST 2011


The fc-cache code uses stat() directly, but we already have a FcStat
helper to workaround misc issues, so export it and convert fc-cache
over.  This will be even more important when we add --root support.

Signed-off-by: Mike Frysinger <vapier at gentoo.org>
---
 fc-cache/fc-cache.c     |    4 ++--
 fontconfig/fontconfig.h |    3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c
index 98039f7..64eb22a 100644
--- a/fc-cache/fc-cache.c
+++ b/fc-cache/fc-cache.c
@@ -154,7 +154,7 @@ scanDirs (FcStrList *list, FcConfig *config, FcBool force, FcBool really_force,
 	    continue;
 	}
 
-	if (stat ((char *) dir, &statb) == -1)
+	if (FcStat (dir, &statb) == -1)
 	{
 	    switch (errno) {
 	    case ENOENT:
@@ -304,7 +304,7 @@ cleanCacheDirectory (FcConfig *config, FcChar8 *dir, FcBool verbose)
 	else
 	{
 	    target_dir = FcCacheDir (cache);
-	    if (stat ((char *) target_dir, &target_stat) < 0)
+	    if (FcStat (target_dir, &target_stat) < 0)
 	    {
 		if (verbose)
 		    printf ("%s: %s: missing directory: %s \n",
diff --git a/fontconfig/fontconfig.h b/fontconfig/fontconfig.h
index 254acc3..cba961d 100644
--- a/fontconfig/fontconfig.h
+++ b/fontconfig/fontconfig.h
@@ -307,6 +307,9 @@ FcBlanksIsMember (FcBlanks *b, FcChar32 ucs4);
 
 /* fccache.c */
 
+FcPublic int
+FcStat (const FcChar8 *file, struct stat *statb);
+
 FcPublic const FcChar8 *
 FcCacheDir(const FcCache *c);
 
-- 
1.7.6.1



More information about the Fontconfig mailing list