1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-09 13:30:26 +02:00

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
This commit is contained in:
Michael Gran 2009-08-09 15:58:49 -07:00
parent 9af080f720
commit b07992900b
2 changed files with 11 additions and 22 deletions

View file

@ -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

View file

@ -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