1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-21 10:42:50 +03:00

Fix some coding issues in BRIN

Reported by David Rowley: variadic macros are a problem.  Get rid of
them using a trick suggested by Tom Lane: add extra parentheses where
needed.  In the future we might decide we don't need the calls at all
and remove them, but it seems appropriate to keep them while this code
is still new.

Also from David Rowley: brininsert() was trying to use a variable before
initializing it.  Fix by moving the brin_form_tuple call (which
initializes the variable) to within the locked section.

Reported by Peter Eisentraut: can't use "new" as a struct member name,
because C++ compilers will choke on it, as reported by cpluspluscheck.
This commit is contained in:
Alvaro Herrera
2014-11-08 00:31:03 -03:00
parent 926f5cea47
commit b89ee54e20
7 changed files with 30 additions and 36 deletions

View File

@@ -72,13 +72,12 @@ typedef struct BrinDesc
#define BRIN_PROCNUM_UNION 4
/* procedure numbers up to 10 are reserved for BRIN future expansion */
#define BRIN_DEBUG
#undef BRIN_DEBUG
/* we allow debug if using GCC; otherwise don't bother */
#if defined(BRIN_DEBUG) && defined(__GNUC__)
#define BRIN_elog(level, ...) elog(level, __VA_ARGS__)
#ifdef BRIN_DEBUG
#define BRIN_elog(args) elog args
#else
#define BRIN_elog(a) void(0)
#define BRIN_elog(args) ((void) 0)
#endif
/* brin.c */