}
while (argv[i])
{
- if (!FcStrSetAdd (dirs, (FcChar8 *) argv[i]))
+ if (!FcStrSetAddFilename (dirs, (FcChar8 *) argv[i]))
{
fprintf (stderr, "%s: Can't add directory\n", argv[0]);
return 1;
{
for (; i < argc; i++)
{
- if (!FcStrSetAdd (args, argv[i]))
+ if (!FcStrSetAddFilename (args, argv[i]))
{
fprintf (stderr, "%s: malloc failure\n", argv[0]);
return 1;
FcDirCacheRead (const FcChar8 *dir, FcBool force, FcConfig *config)
{
FcCache *cache = NULL;
- FcChar8 *canon_dir;
- canon_dir = FcStrCanonFilename (dir);
- if (!canon_dir) canon_dir = (FcChar8 *) dir;
-
- if (config && !FcConfigAcceptFilename (config, canon_dir)) {
- goto bail;
- }
+ if (config && !FcConfigAcceptFilename (config, dir))
+ return NULL;
/* Try to use existing cache file */
if (!force)
- cache = FcDirCacheLoad (canon_dir, config, NULL);
+ cache = FcDirCacheLoad (dir, config, NULL);
/* Not using existing cache file, construct new cache */
if (!cache)
- cache = FcDirCacheScan (canon_dir, config);
-
-bail:
- if (canon_dir != dir)
- free (canon_dir);
+ cache = FcDirCacheScan (dir, config);
return cache;
}
if (*s == '~')
{
FcChar8 *home = FcConfigHome ();
+ FcChar8 *full;
int size;
if (!home)
return 0;
size = strlen ((char *) home) + strlen ((char *) s);
- new = (FcChar8 *) malloc (size);
+ full = (FcChar8 *) malloc (size);
if (!new)
return 0;
- FcMemAlloc (FC_MEM_STRING, size);
- strcpy ((char *) new, (char *) home);
- strcat ((char *) new, (char *) s + 1);
+ strcpy ((char *) full, (char *) home);
+ strcat ((char *) full, (char *) s + 1);
+ new = FcStrCanonFilename (full);
+ free (full);
}
else
- {
- int size = strlen ((char *) s) + 1;
- new = (FcChar8 *) malloc (size);
- if (!new)
- return 0;
- FcMemAlloc (FC_MEM_STRING, size);
- memcpy (new, s, size);
- }
+ new = FcStrCanonFilename (s);
return new;
}
FcChar8 *file;
FcChar8 *f;
const FcChar8 *slash;
+ int size;
if (*s != '/')
{
FcStrFree (full);
return file;
}
- file = malloc (strlen ((char *) s) + 1);
+ size = strlen ((char *) s) + 1;
+ file = malloc (size);
if (!file)
return NULL;
+ FcMemAlloc (FC_MEM_STRING, size);
slash = NULL;
f = file;
for (;;) {