Fix some redundancy use of semicolon in do-while macros (#8221)

* Fix some redundancy use of semicolon in do-while macros
This commit is contained in:
sundb 2020-12-22 14:57:45 +08:00 committed by GitHub
parent 4c13945c37
commit 4bc14da2b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 12 additions and 13 deletions

View File

@ -51,7 +51,7 @@
#define _EL_CLEANUP(ctx) do { \
if ((ctx)->ev.cleanup) (ctx)->ev.cleanup((ctx)->ev.data); \
ctx->ev.cleanup = NULL; \
} while(0);
} while(0)
static inline void refreshTimeout(redisAsyncContext *ctx) {
#define REDIS_TIMER_ISSET(tvp) \

View File

@ -915,7 +915,7 @@ badfmt: /* Bad format errors */
addReplyBulkCString(c,_var ? _var : ""); \
matches++; \
} \
} while(0);
} while(0)
#define config_get_bool_field(_name,_var) do { \
if (stringmatch(pattern,_name,1)) { \
@ -923,7 +923,7 @@ badfmt: /* Bad format errors */
addReplyBulkCString(c,_var ? "yes" : "no"); \
matches++; \
} \
} while(0);
} while(0)
#define config_get_numerical_field(_name,_var) do { \
if (stringmatch(pattern,_name,1)) { \
@ -932,8 +932,7 @@ badfmt: /* Bad format errors */
addReplyBulkCString(c,buf); \
matches++; \
} \
} while(0);
} while(0)
void configGetCommand(client *c) {
robj *o = c->argv[2];

View File

@ -38,4 +38,4 @@
fprintf(fp,__VA_ARGS__); \
fprintf(fp,"\n"); \
fclose(fp); \
} while (0);
} while (0)

View File

@ -1215,7 +1215,7 @@ dictType BenchmarkDictType = {
#define end_benchmark(msg) do { \
elapsed = timeInMilliseconds()-start; \
printf(msg ": %ld items in %lld ms\n", count, elapsed); \
} while(0);
} while(0)
/* dict-benchmark [count] */
int main(int argc, char **argv) {

View File

@ -364,7 +364,7 @@ int TestAssertIntegerReply(RedisModuleCtx *ctx, RedisModuleCallReply *reply, lon
do { \
RedisModule_Log(ctx,"warning","Testing %s", name); \
reply = RedisModule_Call(ctx,name,__VA_ARGS__); \
} while (0);
} while (0)
/* TEST.IT -- Run all the tests. */
int TestIt(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {

View File

@ -69,7 +69,7 @@ static const size_t optimization_level[] = {4096, 8192, 16384, 32768, 65536};
printf("%s:%s:%d:\t", __FILE__, __FUNCTION__, __LINE__); \
printf(__VA_ARGS__); \
printf("\n"); \
} while (0);
} while (0)
#endif
/* Bookmarks forward declarations */

View File

@ -605,7 +605,7 @@ typedef struct RedisModuleIO {
iovar.ver = 0; \
iovar.key = keyptr; \
iovar.ctx = NULL; \
} while(0);
} while(0)
/* This is a structure used to export DEBUG DIGEST capabilities to Redis
* modules. We want to capture both the ordered and unordered elements of
@ -621,7 +621,7 @@ typedef struct RedisModuleDigest {
#define moduleInitDigestContext(mdvar) do { \
memset(mdvar.o,0,sizeof(mdvar.o)); \
memset(mdvar.x,0,sizeof(mdvar.x)); \
} while(0);
} while(0)
/* Objects encoding. Some kind of objects like Strings and Hashes can be
* internally represented in multiple ways. The 'encoding' field of the object

View File

@ -44,7 +44,7 @@ int __test_num = 0;
#define test_cond(descr,_c) do { \
__test_num++; printf("%d - %s: ", __test_num, descr); \
if(_c) printf("PASSED\n"); else {printf("FAILED\n"); __failed_tests++;} \
} while(0);
} while(0)
#define test_report() do { \
printf("%d tests, %d passed, %d failed\n", __test_num, \
__test_num-__failed_tests, __failed_tests); \
@ -52,6 +52,6 @@ int __test_num = 0;
printf("=== WARNING === We have failed tests here...\n"); \
exit(1); \
} \
} while(0);
} while(0)
#endif