Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb4a57b0

Browse files
committed
Add more missing 'do { ... } while (0)' in missing macros. Without it,
these macros fail in if/else cases:#define X \{ \... \}{if (...)X;else...}with proper setup:#define X \do { \... \} while (0)it works fine.
1 parent309a04f commitb4a57b0

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

‎contrib/pg_resetxlog/pg_resetxlog.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
* Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
2424
* Portions Copyright (c) 1994, Regents of the University of California
2525
*
26-
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.6 2001/07/19 02:12:34 tgl Exp $
26+
* $Header: /cvsroot/pgsql/contrib/pg_resetxlog/Attic/pg_resetxlog.c,v 1.7 2001/10/25 00:55:48 momjian Exp $
2727
*
2828
*-------------------------------------------------------------------------
2929
*/
@@ -273,7 +273,7 @@ static uint32 crc_tableV0[] = {
273273
#defineINIT_CRC64V0(crc)((crc).crc1 = 0xffffffff, (crc).crc2 = 0xffffffff)
274274
#defineFIN_CRC64V0(crc)((crc).crc1 ^= 0xffffffff, (crc).crc2 ^= 0xffffffff)
275275
#defineCOMP_CRC64V0(crc,data,len)\
276-
{\
276+
do{\
277277
uint32 __c1 = (crc).crc1;\
278278
uint32 __c2 = (crc).crc2;\
279279
char*__data = (char *) (data);\
@@ -289,7 +289,7 @@ static uint32 crc_tableV0[] = {
289289
__c1 = crc_tableV0[(__c1 ^ *__data++) & 0xff] ^ (__c1 >> 8);\
290290
(crc).crc1 = __c1;\
291291
(crc).crc2 = __c2;\
292-
}
292+
} while (0)
293293

294294
#defineEQ_CRC64V0(c1,c2) ((c1).crc1 == (c2).crc1 && (c1).crc2 == (c2).crc2)
295295

‎contrib/pgcrypto/crypt-blowfish.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,13 +359,13 @@ static unsigned char BF_atoi64[0x60] = {
359359
};
360360

361361
#defineBF_safe_atoi64(dst,src) \
362-
{ \
362+
do{ \
363363
tmp = (unsigned char)(src); \
364364
if ((unsigned int)(tmp -= 0x20) >= 0x60) return -1; \
365365
tmp = BF_atoi64[tmp]; \
366366
if (tmp > 63) return -1; \
367367
(dst) = tmp; \
368-
}
368+
} while (0)
369369

370370
staticintBF_decode(BF_word*dst,constchar*src,intsize)
371371
{

‎contrib/pgcrypto/rijndael.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -255,25 +255,25 @@ gen_tabs(void)
255255
/* initialise the key schedule from the user supplied key */
256256

257257
#defineloop4(i) \
258-
{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
258+
do{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
259259
t ^= e_key[4 * i]; e_key[4 * i + 4] = t; \
260260
t ^= e_key[4 * i + 1]; e_key[4 * i + 5] = t; \
261261
t ^= e_key[4 * i + 2]; e_key[4 * i + 6] = t; \
262262
t ^= e_key[4 * i + 3]; e_key[4 * i + 7] = t; \
263-
}
263+
} while (0)
264264

265265
#defineloop6(i) \
266-
{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
266+
do{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
267267
t ^= e_key[6 * i]; e_key[6 * i + 6] = t; \
268268
t ^= e_key[6 * i + 1]; e_key[6 * i + 7] = t; \
269269
t ^= e_key[6 * i + 2]; e_key[6 * i + 8] = t; \
270270
t ^= e_key[6 * i + 3]; e_key[6 * i + 9] = t; \
271271
t ^= e_key[6 * i + 4]; e_key[6 * i + 10] = t; \
272272
t ^= e_key[6 * i + 5]; e_key[6 * i + 11] = t; \
273-
}
273+
} while (0)
274274

275275
#defineloop8(i) \
276-
{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
276+
do{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
277277
t ^= e_key[8 * i]; e_key[8 * i + 8] = t; \
278278
t ^= e_key[8 * i + 1]; e_key[8 * i + 9] = t; \
279279
t ^= e_key[8 * i + 2]; e_key[8 * i + 10] = t; \
@@ -283,7 +283,7 @@ gen_tabs(void)
283283
t ^= e_key[8 * i + 5]; e_key[8 * i + 13] = t; \
284284
t ^= e_key[8 * i + 6]; e_key[8 * i + 14] = t; \
285285
t ^= e_key[8 * i + 7]; e_key[8 * i + 15] = t; \
286-
}
286+
} while (0)
287287

288288
rijndael_ctx*
289289
rijndael_set_key(rijndael_ctx*ctx,constu4byte*in_key,constu4bytekey_len,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp