xkbcomp: Replace open-coded strdup
authorDaniel Stone <daniel@fooishbar.org>
Tue, 15 Jun 2010 14:13:56 +0000 (15:13 +0100)
committerDaniel Stone <daniel@fooishbar.org>
Tue, 22 Jun 2010 14:56:55 +0000 (15:56 +0100)
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
src/xkbcomp/xkbpath.c

index 9281421..b67ac46 100644 (file)
@@ -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;
 }