History

tccpp.c: Define and use tok_last for checking if last token is space.

Edmund Grimley Evans committed 11 years ago

Commit 20f0c171 parent b0515491 file · +16 −1Browse files

Unified · Split

tccpp.c+16−1
@@ -1032,6 +1032,19 @@ static inline void TOK_GET(int *t, const int **pp, CValue *cv) · 1031 unmodified lines
1032 *pp = p;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. */
1037static 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
1035static int macro_is_equal(const int *a, const int *b)1048static int macro_is_equal(const int *a, const int *b)
1036{1049{
1037 char buf[STRING_MAX_SIZE + 1];1050 char buf[STRING_MAX_SIZE + 1];
@@ -3266,7 +3279,9 @@ static void macro_subst( · 2228 unmodified lines
3266 end_macro ();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 } else {3286 } else {
3272 3287

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t