From: Behdad Esfahbod Date: Sun, 28 Dec 2008 09:06:01 +0000 (-0500) Subject: Consistently use FcStat() over stat() in all places X-Git-Tag: 2.7.0~155 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=f69db8d49cbd929b80527719be6c0b1e6d49ccac;p=fontconfig.git Consistently use FcStat() over stat() in all places --- diff --git a/src/fcatomic.c b/src/fcatomic.c index 180168c..fca2399 100644 --- a/src/fcatomic.c +++ b/src/fcatomic.c @@ -142,7 +142,7 @@ FcAtomicLock (FcAtomic *atomic) * machines sharing the same filesystem will have clocks * reasonably close to each other. */ - if (stat ((char *) atomic->lck, &lck_stat) >= 0) + if (FcStat ((char *) atomic->lck, &lck_stat) >= 0) { time_t now = time (0); if ((long int) (now - lck_stat.st_mtime) > 10 * 60) diff --git a/src/fccache.c b/src/fccache.c index c7a2dcd..b5aa4ea 100644 --- a/src/fccache.c +++ b/src/fccache.c @@ -85,7 +85,7 @@ typedef __int64 INT64; * just use the UTC timestamps from NTFS, converted to the Unix epoch. */ -static int +int FcStat (const char *file, struct stat *statb) { WIN32_FILE_ATTRIBUTE_DATA wfad; @@ -131,11 +131,6 @@ FcStat (const char *file, struct stat *statb) return 0; } - -#else - -#define FcStat stat - #endif static const char bin2hex[] = { '0', '1', '2', '3', diff --git a/src/fccfg.c b/src/fccfg.c index 70748c8..d375d8a 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -129,7 +129,7 @@ FcConfigNewestFile (FcStrSet *files) if (list) { while ((file = FcStrListNext (list))) - if (stat ((char *) file, &statb) == 0) + if (FcStat ((char *) file, &statb) == 0) if (!newest.set || statb.st_mtime - newest.time > 0) { newest.set = FcTrue; diff --git a/src/fcdir.c b/src/fcdir.c index 59ea33d..5166408 100644 --- a/src/fcdir.c +++ b/src/fcdir.c @@ -30,7 +30,7 @@ FcFileIsDir (const FcChar8 *file) { struct stat statb; - if (stat ((const char *) file, &statb) != 0) + if (FcStat ((const char *) file, &statb) != 0) return FcFalse; return S_ISDIR(statb.st_mode); } @@ -175,7 +175,7 @@ FcDirCacheScan (const FcChar8 *dir, FcConfig *config) ret = FcFalse; goto bail_1; } - if (stat ((char *) dir, &dir_stat) < 0) + if (FcStat ((char *) dir, &dir_stat) < 0) { ret = FcFalse; goto bail_1; diff --git a/src/fcint.h b/src/fcint.h index 9a768c2..47925b0 100644 --- a/src/fcint.h +++ b/src/fcint.h @@ -524,6 +524,13 @@ FcCacheFini (void); FcPrivate void FcDirCacheReference (FcCache *cache, int nref); +#ifdef _WIN32 +FcPrivate int +FcStat (const char *file, struct stat *statb) +#else +#define FcStat stat +#endif + /* fccfg.c */ FcPrivate FcBool