Content-Length: 288018 | pFad | http://github.com/postgrespro/postgres/commit/e5507631219392d08f327194c840e042e3577fc5

0A Improve comment about 'if (1)' hack in copy.c macros. · postgrespro/postgres@e550763 · GitHub
Skip to content

Commit e550763

Browse files
committed
Improve comment about 'if (1)' hack in copy.c macros.
1 parent 1a0ebe6 commit e550763

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/backend/commands/copy.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.310 2009/06/03 14:48:33 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.311 2009/06/03 15:06:48 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -175,11 +175,13 @@ typedef struct
175175
/*
176176
* These macros centralize code used to process line_buf and raw_buf buffers.
177177
* They are macros because they often do continue/break control and to avoid
178-
* function call overhead in tight COPY loops. "((void) 0)" is used to silence
179-
* compiler warnings.
178+
* function call overhead in tight COPY loops.
180179
*
181-
* We must use "if (1)" because "do {} while(0)" overrides the continue/break
182-
* processing. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros.
180+
* We must use "if (1)" because the usual "do {...} while(0)" wrapper would
181+
* prevent the continue/break processing from working. We end the "if (1)"
182+
* with "else ((void) 0)" to ensure the "if" does not unintentionally match
183+
* any "else" in the calling code, and to avoid any compiler warnings about
184+
* empty statements. See http://www.cit.gu.edu.au/~anthony/info/C/C.macros.
183185
*/
184186

185187
/*

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/postgrespro/postgres/commit/e5507631219392d08f327194c840e042e3577fc5

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy