diff options
Diffstat (limited to 'xkbpath.c')
-rw-r--r-- | xkbpath.c | 9 |
1 files changed, 3 insertions, 6 deletions
@@ -224,14 +224,13 @@ XkbAddDirectoryToPath(const char *dir) else includePath = new; } - includePath[nPathEntries] = - (char *) calloc(strlen(dir) + 1, sizeof(char)); + includePath[nPathEntries] = strdup(dir); if (includePath[nPathEntries] == NULL) { WSGO("Allocation failed (includePath[%d])\n", nPathEntries); return False; } - strcpy(includePath[nPathEntries++], dir); + nPathEntries++; return True; } @@ -405,9 +404,7 @@ XkbFindFileInPath(const char *name, unsigned type, char **pathRtrn) if ((file != NULL) && (pathRtrn != NULL)) { - *pathRtrn = (char *) calloc(strlen(buf) + 1, sizeof(char)); - if (*pathRtrn != NULL) - strcpy(*pathRtrn, buf); + *pathRtrn = strdup(buf); } return file; } |