Commit c73406c2 authored by WuYunlong's avatar WuYunlong Committed by Oran Agra
Browse files

Fix redundancy use of semicolon in do-while macros in ziplist.c. (#7832)

this is very dangerous bug, but it looks like it didn't cause any harm.

(cherry picked from commit 63cd4d4e)
parent c1423c01
...@@ -390,7 +390,7 @@ unsigned int zipStoreEntryEncoding(unsigned char *p, unsigned char encoding, uns ...@@ -390,7 +390,7 @@ unsigned int zipStoreEntryEncoding(unsigned char *p, unsigned char encoding, uns
(lensize) = 1; \ (lensize) = 1; \
(len) = zipIntSize(encoding); \ (len) = zipIntSize(encoding); \
} \ } \
} while(0); } while(0)
/* Encode the length of the previous entry and write it to "p". This only /* Encode the length of the previous entry and write it to "p". This only
* uses the larger encoding (required in __ziplistCascadeUpdate). */ * uses the larger encoding (required in __ziplistCascadeUpdate). */
...@@ -426,7 +426,7 @@ unsigned int zipStorePrevEntryLength(unsigned char *p, unsigned int len) { ...@@ -426,7 +426,7 @@ unsigned int zipStorePrevEntryLength(unsigned char *p, unsigned int len) {
} else { \ } else { \
(prevlensize) = 5; \ (prevlensize) = 5; \
} \ } \
} while(0); } while(0)
/* Return the length of the previous element, and the number of bytes that /* Return the length of the previous element, and the number of bytes that
* are used in order to encode the previous element length. * are used in order to encode the previous element length.
...@@ -444,7 +444,7 @@ unsigned int zipStorePrevEntryLength(unsigned char *p, unsigned int len) { ...@@ -444,7 +444,7 @@ unsigned int zipStorePrevEntryLength(unsigned char *p, unsigned int len) {
memcpy(&(prevlen), ((char*)(ptr)) + 1, 4); \ memcpy(&(prevlen), ((char*)(ptr)) + 1, 4); \
memrev32ifbe(&prevlen); \ memrev32ifbe(&prevlen); \
} \ } \
} while(0); } while(0)
/* Given a pointer 'p' to the prevlen info that prefixes an entry, this /* Given a pointer 'p' to the prevlen info that prefixes an entry, this
* function returns the difference in number of bytes needed to encode * function returns the difference in number of bytes needed to encode
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment