summaryrefslogtreecommitdiff
path: root/include/misc.h
diff options
context:
space:
mode:
authorMatt Turner <mattst88@gmail.com>2011-08-04 15:35:41 -0400
committerMatt Turner <mattst88@gmail.com>2011-09-21 17:12:04 -0400
commit2c7c520cfe0df30f4bc3adba59d9c62582823bf8 (patch)
treef47282ce2f815acc691cfe188850adf8d6fbfcc3 /include/misc.h
parentc10bad3d3e8ff1b90014770fd470f9c67263e46f (diff)
Use internal temp variable for swap macros
Also, fix whitespace, mainly around swaps(&rep.sequenceNumber) Reviewed-by: Peter Harris <pharris@opentext.com> Signed-off-by: Matt Turner <mattst88@gmail.com>
Diffstat (limited to 'include/misc.h')
-rw-r--r--include/misc.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/include/misc.h b/include/misc.h
index 48492573e..cca30d2d0 100644
--- a/include/misc.h
+++ b/include/misc.h
@@ -256,19 +256,21 @@ version_compare(uint16_t a_major, uint16_t a_minor,
SwapLongs((CARD32 *)(stuff + 1), LengthRestL(stuff))
/* byte swap a 32-bit value */
-#define swapl(x, n) { \
- n = ((char *) (x))[0];\
+#define swapl(x) do { \
+ char n = ((char *) (x))[0];\
((char *) (x))[0] = ((char *) (x))[3];\
((char *) (x))[3] = n;\
n = ((char *) (x))[1];\
((char *) (x))[1] = ((char *) (x))[2];\
- ((char *) (x))[2] = n; }
+ ((char *) (x))[2] = n;\
+ } while (0)
/* byte swap a short */
-#define swaps(x, n) { \
- n = ((char *) (x))[0];\
+#define swaps(x) do { \
+ char n = ((char *) (x))[0];\
((char *) (x))[0] = ((char *) (x))[1];\
- ((char *) (x))[1] = n; }
+ ((char *) (x))[1] = n;\
+ } while (0)
/* copy 32-bit value from src to dst byteswapping on the way */
#define cpswapl(src, dst) { \