mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-03-01 17:35:38 +08:00
preproc: Make the preprocessor use nasm_catfile for include
All include paths to nasm must already have a trailing separator prefix which is uncommon among tools. Change to using nasm_catfile which gives a more normal behaviour. https://bugzilla.nasm.us/show_bug.cgi?id=3392205 Signed-off-by: night199uk <night199uk@hermitcrabslab.com> Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
parent
e1bd3bc7b4
commit
fdb1a1b151
@ -1515,19 +1515,18 @@ static FILE *inc_fopen_search(const char *file, StrList **slpath,
|
||||
FILE *fp;
|
||||
char *prefix = "";
|
||||
const IncPath *ip = ipath;
|
||||
int len = strlen(file);
|
||||
size_t prefix_len = 0;
|
||||
int len;
|
||||
StrList *sl;
|
||||
size_t path_len;
|
||||
char *sp;
|
||||
bool found;
|
||||
|
||||
while (1) {
|
||||
path_len = prefix_len + len + 1;
|
||||
|
||||
sl = nasm_malloc(path_len + sizeof sl->next);
|
||||
memcpy(sl->str, prefix, prefix_len);
|
||||
memcpy(sl->str+prefix_len, file, len+1);
|
||||
sp = nasm_catfile(prefix, file);
|
||||
len = strlen(sp) + 1;
|
||||
sl = nasm_malloc(len + sizeof sl->next);
|
||||
memcpy(sl->str, sp, len);
|
||||
sl->next = NULL;
|
||||
nasm_free(sp);
|
||||
|
||||
if (omode == INC_PROBE) {
|
||||
fp = NULL;
|
||||
@ -1547,7 +1546,6 @@ static FILE *inc_fopen_search(const char *file, StrList **slpath,
|
||||
return NULL;
|
||||
|
||||
prefix = ip->path;
|
||||
prefix_len = strlen(prefix);
|
||||
ip = ip->next;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user