Unified · Split
| @@ -1032,6 +1032,19 @@ static inline void TOK_GET(int *t, const int **pp, CValue *cv) · 1031 unmodified lines | ||
| 1032 | 1032 | *pp = p; |
| 1033 | 1033 | } |
| 1034 | 1034 | |
| 1035 | +/* Calling this function is expensive, but it is not possible | |
| 1036 | + to read a token string backwards. */ | |
| 1037 | +static int tok_last(const int *str0, const int *str1) | |
| 1038 | +{ | |
| 1039 | + const int *str = str0; | |
| 1040 | + int tok = 0; | |
| 1041 | + CValue cval; | |
| 1042 | + | |
| 1043 | + while (str < str1) | |
| 1044 | + TOK_GET(&tok, &str, &cval); | |
| 1045 | + return tok; | |
| 1046 | +} | |
| 1047 | + | |
| 1035 | 1048 | static int macro_is_equal(const int *a, const int *b) |
| 1036 | 1049 | { |
| 1037 | 1050 | char buf[STRING_MAX_SIZE + 1]; |
| @@ -3266,7 +3279,9 @@ static void macro_subst( · 2228 unmodified lines | ||
| 3266 | 3279 | end_macro (); |
| 3267 | 3280 | } |
| 3268 | 3281 | |
| 3269 | − spc = tok_str->len && is_space(tok_str->str[tok_str->len-1]); | |
| 3282 | + spc = (tok_str->len && | |
| 3283 | + is_space(tok_last(tok_str->str, | |
| 3284 | + tok_str->str + tok_str->len))); | |
| 3270 | 3285 | |
| 3271 | 3286 | } else { |
| 3272 | 3287 | |