From d054ab15fff7acaa43c00982427718dc8220cca9 Mon Sep 17 00:00:00 2001 From: KarthikSubbarao Date: Mon, 1 Jul 2024 19:16:30 +0000 Subject: [PATCH] Address some of the format suggestions Signed-off-by: KarthikSubbarao --- src/networking.c | 4 ++-- src/script_lua.c | 7 +++---- src/server.c | 2 +- src/server.h | 4 ++-- 4 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/networking.c b/src/networking.c index abbbb1b48f..0f21c63be1 100644 --- a/src/networking.c +++ b/src/networking.c @@ -548,9 +548,9 @@ void afterErrorReply(client *c, const char *s, size_t len, int flags) { * custom LUA errors, we track the error under `error_LUA` */ if (flags & ERR_REPLY_FLAG_LUA && raxSize(server.errors) >= ERROR_STATS_LUA_LIMIT) { incrementErrorCount(LUA_ERRORSTATS_OVERFLOW_ERR, strlen(LUA_ERRORSTATS_OVERFLOW_ERR)); - /* If the string already starts with "-..." then the error prefix - * is provided by the caller ( we limit the search to 32 chars). Otherwise we use "-ERR". */ } else if (s[0] != '-') { + /* If the string already starts with "-..." then the error prefix + * is provided by the caller ( we limit the search to 32 chars). Otherwise we use "-ERR". */ incrementErrorCount("ERR", 3); } else { char *spaceloc = memchr(s, ' ', len < 32 ? len : 32); diff --git a/src/script_lua.c b/src/script_lua.c index 7851cf26e8..b7467f3772 100644 --- a/src/script_lua.c +++ b/src/script_lua.c @@ -617,10 +617,9 @@ static void luaReplyToRedisReply(client *c, client *script_client, lua_State *lu 1); /* pop the error message, we will use luaExtractErrorInformation to get error information */ errorInfo err_info = {0}; luaExtractErrorInformation(lua, &err_info); - addReplyErrorFormatEx(c, - ERR_REPLY_FLAG_LUA | (err_info.ignore_err_stats_update? ERR_REPLY_FLAG_NO_STATS_UPDATE: 0), - "-%s", - err_info.msg); + addReplyErrorFormatEx( + c, ERR_REPLY_FLAG_LUA | (err_info.ignore_err_stats_update ? ERR_REPLY_FLAG_NO_STATS_UPDATE : 0), "-%s", + err_info.msg); luaErrorInformationDiscard(&err_info); lua_pop(lua, 1); /* pop the result table */ return; diff --git a/src/server.c b/src/server.c index 18c15399b0..df16b09e39 100644 --- a/src/server.c +++ b/src/server.c @@ -4048,7 +4048,7 @@ int processCommand(client *c) { void incrementErrorCount(const char *fullerr, size_t namelen) { void *result; - if (!raxFind(server.errors,(unsigned char*)fullerr,namelen,&result)) { + if (!raxFind(server.errors, (unsigned char *)fullerr, namelen, &result)) { struct serverError *error = zmalloc(sizeof(*error)); error->count = 1; raxInsert(server.errors, (unsigned char *)fullerr, namelen, error, NULL); diff --git a/src/server.h b/src/server.h index 24656641c4..330b54cb7a 100644 --- a/src/server.h +++ b/src/server.h @@ -1579,8 +1579,8 @@ struct valkeyServer { dict *commands; /* Command table */ dict *orig_commands; /* Command table before command renaming. */ aeEventLoop *el; - rax *errors; /* Errors table */ - unsigned int lruclock; /* Clock for LRU eviction */ + rax *errors; /* Errors table */ + unsigned int lruclock; /* Clock for LRU eviction */ volatile sig_atomic_t shutdown_asap; /* Shutdown ordered by signal handler. */ mstime_t shutdown_mstime; /* Timestamp to limit graceful shutdown. */ int last_sig_received; /* Indicates the last SIGNAL received, if any (e.g., SIGINT or SIGTERM). */