summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsundb <sundbcn@gmail.com>2021-01-10 01:52:42 +0800
committerGitHub <noreply@github.com>2021-01-09 19:52:42 +0200
commit36f1dea5e19982fac81d44de5bb0a4febe456b06 (patch)
tree52d7dbd912896da125d18fb7862d862a2104e8f2 /src
parent8dd16caec833aebde3a12c7d7f9b6456554c8616 (diff)
downloadredis-36f1dea5e19982fac81d44de5bb0a4febe456b06.tar.gz
Fix compile warning when define REDIS_TEST (#8261)
Co-authored-by: Oran Agra <oran@redislabs.com>
Diffstat (limited to 'src')
-rw-r--r--src/crc64.c4
-rw-r--r--src/intset.c6
-rw-r--r--src/quicklist.c23
-rw-r--r--src/rax.c2
-rw-r--r--src/ziplist.c4
5 files changed, 12 insertions, 27 deletions
diff --git a/src/crc64.c b/src/crc64.c
index 4cbc019f6..6c9432c4a 100644
--- a/src/crc64.c
+++ b/src/crc64.c
@@ -134,7 +134,7 @@ int crc64Test(int argc, char *argv[]) {
printf("[calcula]: e9c6d914c4b8d9ca == %016" PRIx64 "\n",
(uint64_t)_crc64(0, "123456789", 9));
printf("[64speed]: e9c6d914c4b8d9ca == %016" PRIx64 "\n",
- (uint64_t)crc64(0, "123456789", 9));
+ (uint64_t)crc64(0, (unsigned char*)"123456789", 9));
char li[] = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed "
"do eiusmod tempor incididunt ut labore et dolore magna "
"aliqua. Ut enim ad minim veniam, quis nostrud exercitation "
@@ -146,7 +146,7 @@ int crc64Test(int argc, char *argv[]) {
printf("[calcula]: c7794709e69683b3 == %016" PRIx64 "\n",
(uint64_t)_crc64(0, li, sizeof(li)));
printf("[64speed]: c7794709e69683b3 == %016" PRIx64 "\n",
- (uint64_t)crc64(0, li, sizeof(li)));
+ (uint64_t)crc64(0, (unsigned char*)li, sizeof(li)));
return 0;
}
diff --git a/src/intset.c b/src/intset.c
index 54afae875..74de87acb 100644
--- a/src/intset.c
+++ b/src/intset.c
@@ -358,12 +358,6 @@ static long long usec(void) {
return (((long long)tv.tv_sec)*1000000)+tv.tv_usec;
}
-#define assert(_e) ((_e)?(void)0:(_assert(#_e,__FILE__,__LINE__),exit(1)))
-static void _assert(char *estr, char *file, int line) {
- printf("\n\n=== ASSERTION FAILED ===\n");
- printf("==> %s:%d '%s' is not true\n",file,line,estr);
-}
-
static intset *createSet(int bits, int size) {
uint64_t mask = (1<<bits)-1;
uint64_t value;
diff --git a/src/quicklist.c b/src/quicklist.c
index 4dc3576ae..32871ac12 100644
--- a/src/quicklist.c
+++ b/src/quicklist.c
@@ -66,7 +66,7 @@ static const size_t optimization_level[] = {4096, 8192, 16384, 32768, 65536};
#else
#define D(...) \
do { \
- printf("%s:%s:%d:\t", __FILE__, __FUNCTION__, __LINE__); \
+ printf("%s:%s:%d:\t", __FILE__, __func__, __LINE__); \
printf(__VA_ARGS__); \
printf("\n"); \
} while (0)
@@ -1508,15 +1508,6 @@ void quicklistBookmarksClear(quicklist *ql) {
#include <stdint.h>
#include <sys/time.h>
-#define assert(_e) \
- do { \
- if (!(_e)) { \
- printf("\n\n=== ASSERTION FAILED ===\n"); \
- printf("==> %s:%d '%s' is not true\n", __FILE__, __LINE__, #_e); \
- err++; \
- } \
- } while (0)
-
#define yell(str, ...) printf("ERROR! " str "\n\n", __VA_ARGS__)
#define OK printf("\tOK\n")
@@ -1529,7 +1520,7 @@ void quicklistBookmarksClear(quicklist *ql) {
#define ERR(x, ...) \
do { \
- printf("%s:%s:%d:\t", __FILE__, __FUNCTION__, __LINE__); \
+ printf("%s:%s:%d:\t", __FILE__, __func__, __LINE__); \
printf("ERROR! " x "\n", __VA_ARGS__); \
err++; \
} while (0)
@@ -1614,7 +1605,7 @@ static int _ql_verify(quicklist *ql, uint32_t len, uint32_t count,
ql_info(ql);
if (len != ql->len) {
- yell("quicklist length wrong: expected %d, got %u", len, ql->len);
+ yell("quicklist length wrong: expected %d, got %lu", len, ql->len);
errors++;
}
@@ -1670,7 +1661,7 @@ static int _ql_verify(quicklist *ql, uint32_t len, uint32_t count,
if (node->encoding != QUICKLIST_NODE_ENCODING_RAW) {
yell("Incorrect compression: node %d is "
"compressed at depth %d ((%u, %u); total "
- "nodes: %u; size: %u; recompress: %d)",
+ "nodes: %lu; size: %u; recompress: %d)",
at, ql->compress, low_raw, high_raw, ql->len, node->sz,
node->recompress);
errors++;
@@ -1680,7 +1671,7 @@ static int _ql_verify(quicklist *ql, uint32_t len, uint32_t count,
!node->attempted_compress) {
yell("Incorrect non-compression: node %d is NOT "
"compressed at depth %d ((%u, %u); total "
- "nodes: %u; size: %u; recompress: %d; attempted: %d)",
+ "nodes: %lu; size: %u; recompress: %d; attempted: %d)",
at, ql->compress, low_raw, high_raw, ql->len, node->sz,
node->recompress, node->attempted_compress);
errors++;
@@ -2706,7 +2697,7 @@ int quicklistTest(int argc, char *argv[]) {
if (node->encoding != QUICKLIST_NODE_ENCODING_RAW) {
ERR("Incorrect compression: node %d is "
"compressed at depth %d ((%u, %u); total "
- "nodes: %u; size: %u)",
+ "nodes: %lu; size: %u)",
at, depth, low_raw, high_raw, ql->len,
node->sz);
}
@@ -2714,7 +2705,7 @@ int quicklistTest(int argc, char *argv[]) {
if (node->encoding != QUICKLIST_NODE_ENCODING_LZF) {
ERR("Incorrect non-compression: node %d is NOT "
"compressed at depth %d ((%u, %u); total "
- "nodes: %u; size: %u; attempted: %d)",
+ "nodes: %lu; size: %u; attempted: %d)",
at, depth, low_raw, high_raw, ql->len,
node->sz, node->attempted_compress);
}
diff --git a/src/rax.c b/src/rax.c
index 1ffb42287..0826b974a 100644
--- a/src/rax.c
+++ b/src/rax.c
@@ -61,7 +61,7 @@ void raxDebugShowNode(const char *msg, raxNode *n);
#ifdef RAX_DEBUG_MSG
#define debugf(...) \
if (raxDebugMsg) { \
- printf("%s:%s:%d:\t", __FILE__, __FUNCTION__, __LINE__); \
+ printf("%s:%s:%d:\t", __FILE__, __func__, __LINE__); \
printf(__VA_ARGS__); \
fflush(stdout); \
}
diff --git a/src/ziplist.c b/src/ziplist.c
index 96ba47e13..a4f38c5e8 100644
--- a/src/ziplist.c
+++ b/src/ziplist.c
@@ -1713,7 +1713,7 @@ int ziplistTest(int argc, char **argv) {
if (p == NULL) {
printf("No entry\n");
} else {
- printf("ERROR: Out of range index should return NULL, returned offset: %ld\n", p-zl);
+ printf("ERROR: Out of range index should return NULL, returned offset: %ld\n", (long)(p-zl));
return 1;
}
printf("\n");
@@ -1763,7 +1763,7 @@ int ziplistTest(int argc, char **argv) {
if (p == NULL) {
printf("No entry\n");
} else {
- printf("ERROR: Out of range index should return NULL, returned offset: %ld\n", p-zl);
+ printf("ERROR: Out of range index should return NULL, returned offset: %ld\n", (long)(p-zl));
return 1;
}
printf("\n");