if (*s == '~')
{
FcChar8 *home = FcConfigHome ();
+ FcChar8 *full;
int size;
if (!home)
return 0;
size = strlen ((char *) home) + strlen ((char *) s);
- new = (FcChar8 *) malloc (size);
- if (!new)
+ full = (FcChar8 *) malloc (size);
+ if (!full)
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 (;;) {