Commit 50a037cacf75b106a2ee31680fb4588a8873a262

Daniel Stone 2010-06-15T15:13:56

xkbcomp: Replace open-coded strdup Signed-off-by: Daniel Stone <daniel@fooishbar.org>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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;
 }