xkbcomp: Replace open-coded strdup Signed-off-by: Daniel Stone <daniel@fooishbar.org>
diff --git a/src/xkbcomp/xkbpath.c b/src/xkbcomp/xkbpath.c
index 9281421..b67ac46 100644
--- a/src/xkbcomp/xkbpath.c
+++ b/src/xkbcomp/xkbpath.c
@@ -246,14 +246,13 @@ XkbAddDirectoryToPath(const char *dir)
return False;
}
}
- 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;
}