[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] -slc: use want_blank instead of copying a space
From: |
Tim Hentenaar |
Subject: |
[PATCH] -slc: use want_blank instead of copying a space |
Date: |
Tue, 16 Jun 2015 03:28:25 +0200 |
Using want_blank instead of copying a space from s_code to e_code avoids
two spaces being emitted by copy_id(). This only happens with -slc.
---
ChangeLog | 5 +++++
src/handletoken.c | 10 +++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index facc512..665ad06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+
+2015-06-16 Tim Hentenaar <address@hidden>
+ * Use want_blank instead of copying a space to e_code to avoid
+ double spaces.
+
2015-06-15 Tim Hentenaar <address@hidden>
* Added -par to -kr.
* Fixed detection of struct initializer lists as block_init.
diff --git a/src/handletoken.c b/src/handletoken.c
index 6effe59..b3a807d 100644
--- a/src/handletoken.c
+++ b/src/handletoken.c
@@ -552,14 +552,14 @@ static void handle_token_rparen(
*(e_code++) = token[0];
- /* Something is swallowing spaces after a 2nd rparen, when we allow
- * single-line conditionals, so make sure we copy it (if there is one).
+ /* Something is setting want_blank to false whereas we need to emit
+ * a space if we have a single-line conditional, so make sure we
+ * indicate that we want a space before the next identifier.
*/
if (settings.allow_single_line_conditionals && *(token - 1) == ')'
- && *(token + 1) == ' ' && *(token + 2) != '{'
- && !parser_state_tos->paren_depth)
+ && *(token + 2) != '{' && !parser_state_tos->paren_depth)
{
- *(e_code++) = *(++token);
+ parser_state_tos->want_blank = true;
}
/* check for end of if (...), or some such */
--
2.3.6
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] -slc: use want_blank instead of copying a space,
Tim Hentenaar <=