]> granicus.if.org Git - yasm/commitdiff
Add trailing slashes on include paths again (functionality deleted in
authorPeter Johnson <peter@tortall.net>
Sat, 28 Oct 2006 22:04:18 +0000 (22:04 -0000)
committerPeter Johnson <peter@tortall.net>
Sat, 28 Oct 2006 22:04:18 +0000 (22:04 -0000)
[1669]).

svn path=/trunk/yasm/; revision=1672

libyasm/file.c

index f558695af621c883febbbabd15a3affb0fb36adb..30515cf44143f7d93460819bcf44005efaf06447 100644 (file)
@@ -468,7 +468,16 @@ void
 yasm_add_include_path(const char *path)
 {
     incpath *np = yasm_xmalloc(sizeof(incpath));
-    np->path = yasm__xstrdup(path);
+    size_t len = strlen(path);
+
+    np->path = yasm_xmalloc(len+2);
+    memcpy(np->path, path, len+1);
+    /* Add trailing slash if it is missing */
+    if (path[len-1] != '\\' && path[len-1] != '/') {
+       np->path[len] = '/';
+       np->path[len+1] = '\0';
+    }
+
     STAILQ_INSERT_TAIL(&incpaths, np, link);
 }