summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2008-12-28 04:06:01 -0500
committerBehdad Esfahbod <behdad@behdad.org>2009-02-13 16:54:01 -0800
commitf69db8d49cbd929b80527719be6c0b1e6d49ccac (patch)
tree26d567e58669f60a2e52b8ab8d11930065397075
parent9e2ed2513bb4c2ecc7ee09c48c1dc677ea58a723 (diff)
Consistently use FcStat() over stat() in all places
-rw-r--r--src/fcatomic.c2
-rw-r--r--src/fccache.c7
-rw-r--r--src/fccfg.c2
-rw-r--r--src/fcdir.c4
-rw-r--r--src/fcint.h7
5 files changed, 12 insertions, 10 deletions
diff --git a/src/fcatomic.c b/src/fcatomic.c
index 180168cf..fca23994 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 c7a2dcdc..b5aa4ea1 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 70748c86..d375d8ad 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 59ea33dc..51664087 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 9a768c24..47925b0c 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