summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--xkbpath.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/xkbpath.c b/xkbpath.c
index ef8d68c..6d9d13a 100644
--- a/xkbpath.c
+++ b/xkbpath.c
@@ -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;
}