From b27a7d51a0b67a71f24c0ce25155964503aada8f Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sat, 28 Oct 2006 22:04:18 +0000 Subject: [PATCH] Add trailing slashes on include paths again (functionality deleted in [1669]). svn path=/trunk/yasm/; revision=1672 --- libyasm/file.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libyasm/file.c b/libyasm/file.c index f558695a..30515cf4 100644 --- a/libyasm/file.c +++ b/libyasm/file.c @@ -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); }