diff options
author | Michael Gran <spk121@yahoo.com> | 2009-08-09 15:58:49 -0700 |
---|---|---|
committer | Michael Gran <spk121@yahoo.com> | 2009-08-09 16:58:14 -0700 |
commit | b07992900bef24596532018d7939384f8632cd0f (patch) | |
tree | 0d3cbea690dd0ffb6cbf7858b3fb6ac19c1cc6a3 | |
parent | 9af080f7206dccffb91409529fff74e6554f2385 (diff) | |
download | guile-b07992900bef24596532018d7939384f8632cd0f.tar.gz |
Port position macros shouldn't require enclosing braces
The port position macros incorrectly required enclosing braces
when used within if statements.
* libguile/ports.h (SCM_INCLINE, SCM_ZEROCOL, SCM_INCCOL)
(SCM_DECCOL, SCM_TABCOL): enclose macro in do/while
* libguile/ports.c (update_port_lf): remove extra braces
-rw-r--r-- | libguile/ports.c | 23 | ||||
-rw-r--r-- | libguile/ports.h | 10 |
2 files changed, 11 insertions, 22 deletions
diff --git a/libguile/ports.c b/libguile/ports.c index 2c1a3898f..4ed5f76d7 100644 --- a/libguile/ports.c +++ b/libguile/ports.c @@ -973,28 +973,17 @@ static void update_port_lf (scm_t_wchar c, SCM port) { if (c == '\a') - { - } + ; /* Do nothing. */ else if (c == '\b') - { - SCM_DECCOL (port); - } + SCM_DECCOL (port); else if (c == '\n') - { - SCM_INCLINE (port); - } + SCM_INCLINE (port); else if (c == '\r') - { - SCM_ZEROCOL (port); - } + SCM_ZEROCOL (port); else if (c == '\t') - { - SCM_TABCOL (port); - } + SCM_TABCOL (port); else - { - SCM_INCCOL (port); - } + SCM_INCCOL (port); } void diff --git a/libguile/ports.h b/libguile/ports.h index d427fecb1..e5c0ffd84 100644 --- a/libguile/ports.h +++ b/libguile/ports.h @@ -155,11 +155,11 @@ SCM_INTERNAL SCM scm_i_port_weak_hash; #define SCM_REVEALED(x) (SCM_PTAB_ENTRY(x)->revealed) #define SCM_SETREVEALED(x, s) (SCM_PTAB_ENTRY(x)->revealed = (s)) -#define SCM_INCLINE(port) {SCM_LINUM (port) += 1; SCM_COL (port) = 0;} -#define SCM_ZEROCOL(port) {SCM_COL (port) = 0;} -#define SCM_INCCOL(port) {SCM_COL (port) += 1;} -#define SCM_DECCOL(port) {if (SCM_COL (port) > 0) SCM_COL (port) -= 1;} -#define SCM_TABCOL(port) {SCM_COL (port) += 8 - SCM_COL (port) % 8;} +#define SCM_INCLINE(port) do {SCM_LINUM (port) += 1; SCM_COL (port) = 0;} while (0) +#define SCM_ZEROCOL(port) do {SCM_COL (port) = 0;} while (0) +#define SCM_INCCOL(port) do {SCM_COL (port) += 1;} while (0) +#define SCM_DECCOL(port) do {if (SCM_COL (port) > 0) SCM_COL (port) -= 1;} while (0) +#define SCM_TABCOL(port) do {SCM_COL (port) += 8 - SCM_COL (port) % 8;} while (0) /* Maximum number of port types. */ #define SCM_I_MAX_PORT_TYPE_COUNT 256 |