X-Git-Url: https://git.wh0rd.org/?a=blobdiff_plain;f=src%2Ffccfg.c;fp=src%2Ffccfg.c;h=6d55f171e216ca886ec6cbe4e78dc4137b4e2959;hb=bb8057ea77ec89e789afbc6e87b7a16d479d3105;hp=09c59919d8f37bd1998f7d530f7b96865512b8a2;hpb=18b8be363ca19666d8e90f8fc124c5b5e9ec15dc;p=fontconfig.git diff --git a/src/fccfg.c b/src/fccfg.c index 09c5991..6d55f17 100644 --- a/src/fccfg.c +++ b/src/fccfg.c @@ -1689,38 +1689,11 @@ static FcChar8 * FcConfigFileExists (const FcChar8 *dir, const FcChar8 *file) { FcChar8 *path; - int size; if (!dir) - dir = (FcChar8 *) ""; + dir = (const FcChar8 *) ""; - size = strlen ((char *) dir) + 1 + strlen ((char *) file) + 1; - /* - * workaround valgrind warning because glibc takes advantage of how it knows memory is - * allocated to implement strlen by reading in groups of 4 - */ - size = (size + 3) & ~3; - - path = malloc (size); - if (!path) - return 0; - - strcpy ((char *) path, (const char *) dir); - /* make sure there's a single separator */ -#ifdef _WIN32 - if ((!path[0] || (path[strlen((char *) path)-1] != '/' && - path[strlen((char *) path)-1] != '\\')) && - !(file[0] == '/' || - file[0] == '\\' || - (isalpha (file[0]) && file[1] == ':' && (file[2] == '/' || file[2] == '\\')))) - strcat ((char *) path, "\\"); -#else - if ((!path[0] || path[strlen((char *) path)-1] != '/') && file[0] != '/') - strcat ((char *) path, "/"); -#endif - strcat ((char *) path, (char *) file); - - FcMemAlloc (FC_MEM_STRING, size); + path = FcStrPathPlus (dir, file, NULL); if (access ((char *) path, R_OK) == 0) return path;