1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

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.
This commit is contained in:
Bruce Momjian
2001-10-25 00:55:48 +00:00
parent 309a04f5b8
commit b4a57b0648
3 changed files with 11 additions and 11 deletions

View File

@ -359,13 +359,13 @@ static unsigned char BF_atoi64[0x60] = {
};
#define BF_safe_atoi64(dst, src) \
{ \
do { \
tmp = (unsigned char)(src); \
if ((unsigned int)(tmp -= 0x20) >= 0x60) return -1; \
tmp = BF_atoi64[tmp]; \
if (tmp > 63) return -1; \
(dst) = tmp; \
}
} while (0)
static int BF_decode(BF_word *dst, const char *src, int size)
{

View File

@ -255,25 +255,25 @@ gen_tabs(void)
/* initialise the key schedule from the user supplied key */
#define loop4(i) \
{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
do { t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
t ^= e_key[4 * i]; e_key[4 * i + 4] = t; \
t ^= e_key[4 * i + 1]; e_key[4 * i + 5] = t; \
t ^= e_key[4 * i + 2]; e_key[4 * i + 6] = t; \
t ^= e_key[4 * i + 3]; e_key[4 * i + 7] = t; \
}
} while (0)
#define loop6(i) \
{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
do { t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
t ^= e_key[6 * i]; e_key[6 * i + 6] = t; \
t ^= e_key[6 * i + 1]; e_key[6 * i + 7] = t; \
t ^= e_key[6 * i + 2]; e_key[6 * i + 8] = t; \
t ^= e_key[6 * i + 3]; e_key[6 * i + 9] = t; \
t ^= e_key[6 * i + 4]; e_key[6 * i + 10] = t; \
t ^= e_key[6 * i + 5]; e_key[6 * i + 11] = t; \
}
} while (0)
#define loop8(i) \
{ t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
do { t = ls_box(rotr(t, 8)) ^ rco_tab[i]; \
t ^= e_key[8 * i]; e_key[8 * i + 8] = t; \
t ^= e_key[8 * i + 1]; e_key[8 * i + 9] = t; \
t ^= e_key[8 * i + 2]; e_key[8 * i + 10] = t; \
@ -283,7 +283,7 @@ gen_tabs(void)
t ^= e_key[8 * i + 5]; e_key[8 * i + 13] = t; \
t ^= e_key[8 * i + 6]; e_key[8 * i + 14] = t; \
t ^= e_key[8 * i + 7]; e_key[8 * i + 15] = t; \
}
} while (0)
rijndael_ctx *
rijndael_set_key(rijndael_ctx *ctx, const u4byte *in_key, const u4byte key_len,