mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Add do { ... } while (0) to more bad macros.
This commit is contained in:
@ -1,4 +1,4 @@
|
||||
/* $Id: md5.c,v 1.6 2001/08/21 00:42:41 momjian Exp $ */
|
||||
/* $Id: md5.c,v 1.7 2001/10/25 01:29:37 momjian Exp $ */
|
||||
/* $KAME: md5.c,v 1.3 2000/02/22 14:01:17 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -41,29 +41,33 @@
|
||||
#define H(X, Y, Z) ((X) ^ (Y) ^ (Z))
|
||||
#define I(X, Y, Z) ((Y) ^ ((X) | (~Z)))
|
||||
|
||||
#define ROUND1(a, b, c, d, k, s, i) { \
|
||||
#define ROUND1(a, b, c, d, k, s, i) \
|
||||
do { \
|
||||
(a) = (a) + F((b), (c), (d)) + X[(k)] + T[(i)]; \
|
||||
(a) = SHIFT((a), (s)); \
|
||||
(a) = (b) + (a); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define ROUND2(a, b, c, d, k, s, i) { \
|
||||
#define ROUND2(a, b, c, d, k, s, i) \
|
||||
do { \
|
||||
(a) = (a) + G((b), (c), (d)) + X[(k)] + T[(i)]; \
|
||||
(a) = SHIFT((a), (s)); \
|
||||
(a) = (b) + (a); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define ROUND3(a, b, c, d, k, s, i) { \
|
||||
#define ROUND3(a, b, c, d, k, s, i) \
|
||||
do { \
|
||||
(a) = (a) + H((b), (c), (d)) + X[(k)] + T[(i)]; \
|
||||
(a) = SHIFT((a), (s)); \
|
||||
(a) = (b) + (a); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define ROUND4(a, b, c, d, k, s, i) { \
|
||||
#define ROUND4(a, b, c, d, k, s, i) \
|
||||
do { \
|
||||
(a) = (a) + I((b), (c), (d)) + X[(k)] + T[(i)]; \
|
||||
(a) = SHIFT((a), (s)); \
|
||||
(a) = (b) + (a); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define Sa 7
|
||||
#define Sb 12
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: sha1.c,v 1.6 2001/08/21 00:42:41 momjian Exp $ */
|
||||
/* $Id: sha1.c,v 1.7 2001/10/25 01:29:37 momjian Exp $ */
|
||||
/* $KAME: sha1.c,v 1.3 2000/02/22 14:01:18 itojun Exp $ */
|
||||
|
||||
/*
|
||||
@ -65,22 +65,24 @@ static uint32 _K[] = {0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xca62c1d6};
|
||||
#define BCOUNT (ctxt->c.b64[0] / 8)
|
||||
#define W(n) (ctxt->m.b32[(n)])
|
||||
|
||||
#define PUTBYTE(x) { \
|
||||
#define PUTBYTE(x) \
|
||||
do { \
|
||||
ctxt->m.b8[(COUNT % 64)] = (x); \
|
||||
COUNT++; \
|
||||
COUNT %= 64; \
|
||||
ctxt->c.b64[0] += 8; \
|
||||
if (COUNT % 64 == 0) \
|
||||
sha1_step(ctxt); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
#define PUTPAD(x) { \
|
||||
#define PUTPAD(x) \
|
||||
do { \
|
||||
ctxt->m.b8[(COUNT % 64)] = (x); \
|
||||
COUNT++; \
|
||||
COUNT %= 64; \
|
||||
if (COUNT % 64 == 0) \
|
||||
sha1_step(ctxt); \
|
||||
}
|
||||
} while (0)
|
||||
|
||||
static void sha1_step(struct sha1_ctxt *);
|
||||
|
||||
|
Reference in New Issue
Block a user