diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2011-06-30 01:36:45 +0400 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2011-06-30 01:36:45 +0400 |
commit | 0ad6a7b293fd048dab2cfebfddf966ec879bcac9 (patch) | |
tree | 5dfb23249d1ec8be5ef9e4f0272bf4a2558a5e72 /preproc.c | |
parent | 194ba892cab16f6cd581b4e8a886b58e26419896 (diff) | |
download | nasm-0ad6a7b293fd048dab2cfebfddf966ec879bcac9.tar.gz nasm-0ad6a7b293fd048dab2cfebfddf966ec879bcac9.tar.bz2 nasm-0ad6a7b293fd048dab2cfebfddf966ec879bcac9.zip |
preproc: Refactor smacro paramters expansion
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
Diffstat (limited to 'preproc.c')
-rw-r--r-- | preproc.c | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -4632,18 +4632,21 @@ again: list_for_each(t, m->expansion) { if (is_smacro_param(t)) { Token *pcopy = tline, **ptail = &pcopy; - Token *ttt, *pt; + Token *ttt; int i, idx; idx = smacro_get_param_idx(t); ttt = params[idx]; - i = paramsize[idx]; - while (--i >= 0) { - pt = *ptail = new_Token(tline, ttt->type, - ttt->text, 0); - ptail = &pt->next; + + /* + * We need smacro paramters appended. + */ + for (i = paramsize[idx]; i > 0; i--) { + *ptail = new_Token(tline, ttt->type, ttt->text, 0); + ptail = &(*ptail)->next; ttt = ttt->next; } + tline = pcopy; } else if (t->type == TOK_PREPROC_Q) { tt = new_Token(tline, TOK_ID, mname, 0); |