mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Add do { ... } while (0) to more bad macros.
This commit is contained in:
@ -129,7 +129,12 @@ static int pg_isprint(int c);
|
||||
#ifdef REDEBUG
|
||||
#define SP(t, s, c) print(m, t, s, c, stdout)
|
||||
#define AT(t, p1, p2, s1, s2) at(m, t, p1, p2, s1, s2)
|
||||
#define NOTE(str) { if (m->eflags®_TRACE) printf("=%s\n", (str)); }
|
||||
#define NOTE(str) \
|
||||
do { \
|
||||
if (m->eflags®_TRACE) \
|
||||
printf("=%s\n", (str)); \
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define SP(t, s, c) /* nothing */
|
||||
#define AT(t, p1, p2, s1, s2) /* nothing */
|
||||
|
@ -114,10 +114,19 @@ static int nope = 0; /* for use in asserts; shuts lint up */
|
||||
#define ASSIGN(d, s) memcpy(d, s, m->g->nstates)
|
||||
#define EQ(a, b) (memcmp(a, b, m->g->nstates) == 0)
|
||||
#define STATEVARS int vn; char *space
|
||||
#define STATESETUP(m, nv) { (m)->space = malloc((nv)*(m)->g->nstates); \
|
||||
if ((m)->space == NULL) return(REG_ESPACE); \
|
||||
(m)->vn = 0; }
|
||||
#define STATETEARDOWN(m) { free((m)->space); }
|
||||
#define STATESETUP(m, nv) \
|
||||
do { \
|
||||
(m)->space = malloc((nv)*(m)->g->nstates); \
|
||||
if ((m)->space == NULL) \
|
||||
return(REG_ESPACE); \
|
||||
(m)->vn = 0; \
|
||||
} while (0)
|
||||
|
||||
#define STATETEARDOWN(m) \
|
||||
do { \
|
||||
free((m)->space); \
|
||||
} while (0)
|
||||
|
||||
#define SETUP(v) ((v) = &m->space[m->vn++ * m->g->nstates])
|
||||
#define onestate int
|
||||
#define INIT(o, n) ((o) = (n))
|
||||
|
Reference in New Issue
Block a user