[Fontconfig] fontconfig: Branch 'master'
Akira TAGOH
tagoh at kemper.freedesktop.org
Wed May 30 21:13:41 PDT 2012
src/fcstat.c | 21 ++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)
New commits:
commit 5254a6630fdf132b0cda62c1bc7e8e40d2639bdf
Author: Akira TAGOH <akira at tagoh.org>
Date: Thu May 31 12:46:55 2012 +0900
Fix a typo and polish the previous change
diff --git a/src/fcstat.c b/src/fcstat.c
index c67c434..d8ede59 100644
--- a/src/fcstat.c
+++ b/src/fcstat.c
@@ -26,6 +26,7 @@
#include "fcint.h"
#include "fcarch.h"
#include <dirent.h>
+#include <limits.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
@@ -159,16 +160,14 @@ Adler32Finish (struct Adler32 *ctx)
return ctx->a + (ctx->b << 16);
}
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
/* dirent.d_type can be relied upon on FAT filesystem */
static FcBool
FcDirChecksumScandirFilter(const struct dirent *entry)
{
-#ifdef HAVE_STRUCT_DIRENT_D_TYPE
return entry->d_type != DT_DIR;
-#else
- return FcFalse;
-#endif
}
+#endif
static int
FcDirChecksumScandirSorter(const struct dirent **lhs, const struct dirent **rhs)
@@ -189,7 +188,11 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
Adler32Init (&ctx);
n = scandir ((const char *)dir, &files,
+#ifdef HAVE_STRUCT_DIRENT_D_TYPE
&FcDirChecksumScandirFilter,
+#else
+ NULL,
+#endif
&FcDirChecksumScandirSorter);
if (n == -1)
return -1;
@@ -203,14 +206,8 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
dtype = files[n]->d_type;
#else
struct stat statb;
- char *f;
+ char f[PATH_MAX + 1];
- f = malloc (len + 1 + dlen + 1);
- if (!f)
- {
- ret = -1;
- goto bail;
- }
memcpy (f, dir, len);
f[len] = FC_DIR_SEPARATOR;
memcpy (&f[len + 1], files[n]->d_name, dlen);
@@ -230,8 +227,6 @@ FcDirChecksum (const FcChar8 *dir, time_t *checksum)
#ifndef HAVE_STRUCT_DIRENT_D_TYPE
bail:
- if (f)
- free (f);
#endif
free (files[n]);
}
More information about the Fontconfig
mailing list