diff options
Diffstat (limited to 'gas/macro.c')
-rw-r--r-- | gas/macro.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/gas/macro.c b/gas/macro.c index 3a0b612..a8a0ae4 100644 --- a/gas/macro.c +++ b/gas/macro.c @@ -305,7 +305,9 @@ getstring (idx, in, acc) { char tchar = in->ptr[idx]; int escaped = 0; + idx++; + while (idx < in->len) { if (in->ptr[idx-1] == '\\') @@ -315,24 +317,29 @@ getstring (idx, in, acc) if (macro_alternate && in->ptr[idx] == '!') { - idx++ ; - sb_add_char (acc, in->ptr[idx++]); + idx ++; + + sb_add_char (acc, in->ptr[idx]); + + idx ++; } else if (escaped && in->ptr[idx] == tchar) { sb_add_char (acc, tchar); - idx++; + idx ++; } else { if (in->ptr[idx] == tchar) { - idx++; + idx ++; + if (idx >= in->len || in->ptr[idx] != tchar) break; } + sb_add_char (acc, in->ptr[idx]); - idx++; + idx ++; } } } |