diff options
author | YaacovHazan <31382944+YaacovHazan@users.noreply.github.com> | 2023-04-20 09:49:19 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 09:49:19 +0300 |
commit | 74959a0f73a44cfe56d5fb95957021c55b0ae214 (patch) | |
tree | 4a338ddebeb6084a9f05f28ef00fdbcb7fda5e03 | |
parent | 091412cf62f90c38cee20c1de2aa1016040d0e99 (diff) | |
download | redis-74959a0f73a44cfe56d5fb95957021c55b0ae214.tar.gz |
Misuse of bool in redis (#12077)
We currently do not allow the use of bool type in redis project.
We didn't catch it in script.c because we included hdr_histogram.h in server.h
Removing it (but still having it in some c files) reducing
the chance to miss the usage of bool type in the future and catch it
in compiling stage.
It also removes the dependency on hdr_histogram for every unit
that includes server.h
-rw-r--r-- | src/latency.c | 1 | ||||
-rw-r--r-- | src/module.c | 1 | ||||
-rw-r--r-- | src/script.c | 2 | ||||
-rw-r--r-- | src/server.c | 1 | ||||
-rw-r--r-- | src/server.h | 3 |
5 files changed, 6 insertions, 2 deletions
diff --git a/src/latency.c b/src/latency.c index a784be88e..3aaf16b5e 100644 --- a/src/latency.c +++ b/src/latency.c @@ -34,6 +34,7 @@ */ #include "server.h" +#include "hdr_histogram.h" /* Dictionary type for latency events. */ int dictStringKeyCompare(dict *d, const void *key1, const void *key2) { diff --git a/src/module.c b/src/module.c index 2197111c2..77256feae 100644 --- a/src/module.c +++ b/src/module.c @@ -58,6 +58,7 @@ #include "monotonic.h" #include "script.h" #include "call_reply.h" +#include "hdr_histogram.h" #include <dlfcn.h> #include <sys/stat.h> #include <sys/wait.h> diff --git a/src/script.c b/src/script.c index 2a7721065..dd0bd3a58 100644 --- a/src/script.c +++ b/src/script.c @@ -130,7 +130,7 @@ uint64_t scriptFlagsToCmdFlags(uint64_t cmd_flags, uint64_t script_flags) { /* Prepare the given run ctx for execution */ int scriptPrepareForRun(scriptRunCtx *run_ctx, client *engine_client, client *caller, const char *funcname, uint64_t script_flags, int ro) { serverAssert(!curr_run_ctx); - bool client_allow_oom = caller->flags & CLIENT_ALLOW_OOM; + int client_allow_oom = !!(caller->flags & CLIENT_ALLOW_OOM); int running_stale = server.masterhost && server.repl_state != REPL_STATE_CONNECTED && diff --git a/src/server.c b/src/server.c index e117b43b3..71a15e2b8 100644 --- a/src/server.c +++ b/src/server.c @@ -36,6 +36,7 @@ #include "atomicvar.h" #include "mt19937-64.h" #include "functions.h" +#include "hdr_histogram.h" #include "syscheck.h" #include <time.h> diff --git a/src/server.h b/src/server.h index b286b6803..222044ab9 100644 --- a/src/server.h +++ b/src/server.h @@ -53,7 +53,6 @@ #include <sys/socket.h> #include <lua.h> #include <signal.h> -#include "hdr_histogram.h" #ifdef HAVE_LIBSYSTEMD #include <systemd/sd-daemon.h> @@ -92,6 +91,8 @@ typedef struct redisObject robj; #include "endianconv.h" #include "crc64.h" +struct hdr_histogram; + /* helpers */ #define numElements(x) (sizeof(x)/sizeof((x)[0])) |