From 5e3be1be09c947810732e7be2a4bb1b0ed75de4a Mon Sep 17 00:00:00 2001 From: Madelyn Olson <34459052+madolson@users.noreply.github.com> Date: Tue, 2 May 2023 17:31:32 -0700 Subject: Remove prototypes with empty declarations (#12020) Technically declaring a prototype with an empty declaration has been deprecated since the early days of C, but we never got a warning for it. C2x will apparently be introducing a breaking change if you are using this type of declarator, so Clang 15 has started issuing a warning with -pedantic. Although not apparently a problem for any of the compiler we build on, if feels like the right thing is to properly adhere to the C standard and use (void). --- src/Makefile | 2 +- src/acl.c | 2 +- src/aof.c | 8 +++--- src/cli_common.c | 2 +- src/cli_common.h | 2 +- src/cluster.c | 10 +++---- src/cluster.h | 2 +- src/config.c | 6 ++-- src/connection.c | 10 +++---- src/connection.h | 16 +++++------ src/db.c | 2 +- src/debug.c | 6 ++-- src/defrag.c | 4 +-- src/eval.c | 8 +++--- src/evict.c | 2 +- src/function_lua.c | 2 +- src/functions.c | 16 +++++------ src/functions.h | 18 ++++++------ src/lazyfree.c | 2 +- src/listpack.c | 4 +-- src/module.c | 40 +++++++++++++------------- src/monotonic.c | 22 +++++++-------- src/monotonic.h | 6 ++-- src/networking.c | 2 +- src/pubsub.c | 4 +-- src/rand.c | 2 +- src/rand.h | 2 +- src/redis-benchmark.c | 16 +++++------ src/redis-cli.c | 14 ++++----- src/redismodule.h | 20 ++++++------- src/replication.c | 12 ++++---- src/script.c | 14 ++++----- src/script.h | 14 ++++----- src/sentinel.c | 6 ++-- src/server.c | 30 ++++++++++---------- src/server.h | 69 ++++++++++++++++++++++----------------------- src/socket.c | 2 +- src/tls.c | 8 +++--- src/unix.c | 2 +- src/ziplist.c | 4 +-- src/zmalloc.c | 4 +-- src/zmalloc.h | 2 +- tests/modules/blockonkeys.c | 2 +- 43 files changed, 210 insertions(+), 211 deletions(-) diff --git a/src/Makefile b/src/Makefile index d8efcafb2..4708d1a0a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -40,7 +40,7 @@ ifneq (,$(findstring FreeBSD,$(uname_S))) STD+=-Wno-c11-extensions endif endif -WARN=-Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations +WARN=-Wall -W -Wno-missing-field-initializers -Werror=deprecated-declarations -Wstrict-prototypes OPT=$(OPTIMIZATION) # Detect if the compiler supports C11 _Atomic. diff --git a/src/acl.c b/src/acl.c index 25a9a0a47..ebf152aaa 100644 --- a/src/acl.c +++ b/src/acl.c @@ -642,7 +642,7 @@ void ACLSetSelectorCommandBitsForCategory(dict *commands, aclSelector *selector, /* This function is responsible for recomputing the command bits for all selectors of the existing users. * It uses the 'command_rules', a string representation of the ordered categories and commands, * to recompute the command bits. */ -void ACLRecomputeCommandBitsFromCommandRulesAllUsers() { +void ACLRecomputeCommandBitsFromCommandRulesAllUsers(void) { raxIterator ri; raxStart(&ri,Users); raxSeek(&ri,"^",NULL,0); diff --git a/src/aof.c b/src/aof.c index 55bca6e7a..468d577f8 100644 --- a/src/aof.c +++ b/src/aof.c @@ -164,12 +164,12 @@ void aofManifestFree(aofManifest *am) { zfree(am); } -sds getAofManifestFileName() { +sds getAofManifestFileName(void) { return sdscatprintf(sdsempty(), "%s%s", server.aof_filename, MANIFEST_NAME_SUFFIX); } -sds getTempAofManifestFileName() { +sds getTempAofManifestFileName(void) { return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX, server.aof_filename, MANIFEST_NAME_SUFFIX); } @@ -464,7 +464,7 @@ sds getNewIncrAofName(aofManifest *am) { } /* Get temp INCR type AOF name. */ -sds getTempIncrAofName() { +sds getTempIncrAofName(void) { return sdscatprintf(sdsempty(), "%s%s%s", TEMP_FILE_NAME_PREFIX, server.aof_filename, INCR_FILE_SUFFIX); } @@ -692,7 +692,7 @@ int aofDelHistoryFiles(void) { } /* Used to clean up temp INCR AOF when AOFRW fails. */ -void aofDelTempIncrAofFile() { +void aofDelTempIncrAofFile(void) { sds aof_filename = getTempIncrAofName(); sds aof_filepath = makePath(server.aof_dirname, aof_filename); serverLog(LL_NOTICE, "Removing the temp incr aof file %s in the background", aof_filename); diff --git a/src/cli_common.c b/src/cli_common.c index 7b4775cde..0b13db5dc 100644 --- a/src/cli_common.c +++ b/src/cli_common.c @@ -191,7 +191,7 @@ ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len) /* Wrapper around OpenSSL (libssl and libcrypto) initialisation */ -int cliSecureInit() +int cliSecureInit(void) { #ifdef USE_OPENSSL ERR_load_crypto_strings(); diff --git a/src/cli_common.h b/src/cli_common.h index c5c4c11aa..cffdee61d 100644 --- a/src/cli_common.h +++ b/src/cli_common.h @@ -37,7 +37,7 @@ int cliSecureConnection(redisContext *c, cliSSLconfig config, const char **err); ssize_t cliWriteConn(redisContext *c, const char *buf, size_t buf_len); -int cliSecureInit(); +int cliSecureInit(void); sds readArgFromStdin(void); diff --git a/src/cluster.c b/src/cluster.c index b20225c8b..69029164e 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -126,7 +126,7 @@ dictType clusterNodesBlackListDictType = { NULL /* allow to expand */ }; -static ConnectionType *connTypeOfCluster() { +static ConnectionType *connTypeOfCluster(void) { if (server.tls_cluster) { return connectionTypeTls(); } @@ -2321,18 +2321,18 @@ uint32_t getAlignedPingExtSize(uint32_t dataSize) { return sizeof(clusterMsgPingExt) + EIGHT_BYTE_ALIGN(dataSize); } -uint32_t getHostnamePingExtSize() { +uint32_t getHostnamePingExtSize(void) { if (sdslen(myself->hostname) == 0) { return 0; } return getAlignedPingExtSize(sdslen(myself->hostname) + 1); } -uint32_t getShardIdPingExtSize() { +uint32_t getShardIdPingExtSize(void) { return getAlignedPingExtSize(sizeof(clusterMsgPingExtShardId)); } -uint32_t getForgottenNodeExtSize() { +uint32_t getForgottenNodeExtSize(void) { return getAlignedPingExtSize(sizeof(clusterMsgPingExtForgottenNode)); } @@ -5559,7 +5559,7 @@ void clusterReplyMultiBulkSlots(client * c) { setDeferredArrayLen(c, slot_replylen, num_masters); } -sds genClusterInfoString() { +sds genClusterInfoString(void) { sds info = sdsempty(); char *statestr[] = {"ok","fail"}; int slots_assigned = 0, slots_ok = 0, slots_pfail = 0, slots_fail = 0; diff --git a/src/cluster.h b/src/cluster.h index cabc9273f..b5ab7d5a5 100644 --- a/src/cluster.h +++ b/src/cluster.h @@ -423,7 +423,7 @@ void slotToChannelDel(sds channel); void clusterUpdateMyselfHostname(void); void clusterUpdateMyselfAnnouncedPorts(void); sds clusterGenNodesDescription(int filter, int use_pport); -sds genClusterInfoString(); +sds genClusterInfoString(void); void freeClusterLink(clusterLink *link); #endif /* __CLUSTER_H */ diff --git a/src/config.c b/src/config.c index 9a3f8d969..6978cc5e7 100644 --- a/src/config.c +++ b/src/config.c @@ -1065,7 +1065,7 @@ void rewriteConfigReleaseState(struct rewriteConfigState *state) { } /* Create the configuration rewrite state */ -struct rewriteConfigState *rewriteConfigCreateState() { +struct rewriteConfigState *rewriteConfigCreateState(void) { struct rewriteConfigState *state = zmalloc(sizeof(*state)); state->option_to_line = dictCreate(&optionToLineDictType); state->rewritten = dictCreate(&optionSetDictType); @@ -1643,7 +1643,7 @@ void rewriteConfigRemoveOrphaned(struct rewriteConfigState *state) { /* This function returns a string representation of all the config options * marked with DEBUG_CONFIG, which can be used to help with debugging. */ -sds getConfigDebugInfo() { +sds getConfigDebugInfo(void) { struct rewriteConfigState *state = rewriteConfigCreateState(); state->force_write = 1; /* Force the output */ state->needs_signature = 0; /* Omit the rewrite signature */ @@ -3260,7 +3260,7 @@ int registerConfigValue(const char *name, const standardConfig *config, int alia /* Initialize configs to their default values and create and populate the * runtime configuration dictionary. */ -void initConfigValues() { +void initConfigValues(void) { configs = dictCreate(&sdsHashDictType); dictExpand(configs, sizeof(static_configs) / sizeof(standardConfig)); for (standardConfig *config = static_configs; config->name != NULL; config++) { diff --git a/src/connection.c b/src/connection.c index 6bb0c9ec1..fd9d5d17a 100644 --- a/src/connection.c +++ b/src/connection.c @@ -57,7 +57,7 @@ int connTypeRegister(ConnectionType *ct) { return C_OK; } -int connTypeInitialize() { +int connTypeInitialize(void) { /* currently socket connection type is necessary */ serverAssert(RedisRegisterConnectionTypeSocket() == C_OK); @@ -88,7 +88,7 @@ ConnectionType *connectionByType(const char *typename) { } /* Cache TCP connection type, query it by string once */ -ConnectionType *connectionTypeTcp() { +ConnectionType *connectionTypeTcp(void) { static ConnectionType *ct_tcp = NULL; if (ct_tcp != NULL) @@ -101,7 +101,7 @@ ConnectionType *connectionTypeTcp() { } /* Cache TLS connection type, query it by string once */ -ConnectionType *connectionTypeTls() { +ConnectionType *connectionTypeTls(void) { static ConnectionType *ct_tls = NULL; static int cached = 0; @@ -116,7 +116,7 @@ ConnectionType *connectionTypeTls() { } /* Cache Unix connection type, query it by string once */ -ConnectionType *connectionTypeUnix() { +ConnectionType *connectionTypeUnix(void) { static ConnectionType *ct_unix = NULL; if (ct_unix != NULL) @@ -141,7 +141,7 @@ int connectionIndexByType(const char *typename) { return -1; } -void connTypeCleanupAll() { +void connTypeCleanupAll(void) { ConnectionType *ct; int type; diff --git a/src/connection.h b/src/connection.h index da8b1b7c7..7c26ac635 100644 --- a/src/connection.h +++ b/src/connection.h @@ -379,7 +379,7 @@ static inline sds connGetPeerCert(connection *conn) { } /* Initialize the redis connection framework */ -int connTypeInitialize(); +int connTypeInitialize(void); /* Register a connection type into redis connection framework */ int connTypeRegister(ConnectionType *ct); @@ -388,13 +388,13 @@ int connTypeRegister(ConnectionType *ct); ConnectionType *connectionByType(const char *typename); /* Fast path to get TCP connection type */ -ConnectionType *connectionTypeTcp(); +ConnectionType *connectionTypeTcp(void); /* Fast path to get TLS connection type */ -ConnectionType *connectionTypeTls(); +ConnectionType *connectionTypeTls(void); /* Fast path to get Unix connection type */ -ConnectionType *connectionTypeUnix(); +ConnectionType *connectionTypeUnix(void); /* Lookup the index of a connection type by type name, return -1 if not found */ int connectionIndexByType(const char *typename); @@ -418,7 +418,7 @@ static inline int connTypeConfigure(ConnectionType *ct, void *priv, int reconfig } /* Walk all the connection types and cleanup them all if possible */ -void connTypeCleanupAll(); +void connTypeCleanupAll(void); /* Test all the connection type has pending data or not. */ int connTypeHasPendingData(void); @@ -441,8 +441,8 @@ static inline aeFileProc *connAcceptHandler(ConnectionType *ct) { /* Get Listeners information, note that caller should free the non-empty string */ sds getListensInfoString(sds info); -int RedisRegisterConnectionTypeSocket(); -int RedisRegisterConnectionTypeUnix(); -int RedisRegisterConnectionTypeTLS(); +int RedisRegisterConnectionTypeSocket(void); +int RedisRegisterConnectionTypeUnix(void); +int RedisRegisterConnectionTypeTLS(void); #endif /* __REDIS_CONNECTION_H */ diff --git a/src/db.c b/src/db.c index 31c8f69bd..de7c601b0 100644 --- a/src/db.c +++ b/src/db.c @@ -562,7 +562,7 @@ int selectDb(client *c, int id) { return C_OK; } -long long dbTotalServerKeyCount() { +long long dbTotalServerKeyCount(void) { long long total = 0; int j; for (j = 0; j < server.dbnum; j++) { diff --git a/src/debug.c b/src/debug.c index 68dcdcc9a..0305e8a73 100644 --- a/src/debug.c +++ b/src/debug.c @@ -2056,9 +2056,9 @@ void dumpCodeAroundEIP(void *eip) { } } -void invalidFunctionWasCalled() {} +void invalidFunctionWasCalled(void) {} -typedef void (*invalidFunctionWasCalledType)(); +typedef void (*invalidFunctionWasCalledType)(void); void sigsegvHandler(int sig, siginfo_t *info, void *secret) { UNUSED(secret); @@ -2227,7 +2227,7 @@ void watchdogScheduleSignal(int period) { it.it_interval.tv_usec = 0; setitimer(ITIMER_REAL, &it, NULL); } -void applyWatchdogPeriod() { +void applyWatchdogPeriod(void) { struct sigaction act; /* Disable watchdog when period is 0 */ diff --git a/src/defrag.c b/src/defrag.c index 5b7fdb775..ff63cf8fd 100644 --- a/src/defrag.c +++ b/src/defrag.c @@ -781,7 +781,7 @@ float getAllocatorFragmentation(size_t *out_frag_bytes) { /* We may need to defrag other globals, one small allocation can hold a full allocator run. * so although small, it is still important to defrag these */ -void defragOtherGlobals() { +void defragOtherGlobals(void) { /* there are many more pointers to defrag (e.g. client argv, output / aof buffers, etc. * but we assume most of these are short lived, we only need to defrag allocations @@ -887,7 +887,7 @@ int defragLaterStep(redisDb *db, long long endtime) { #define LIMIT(y, min, max) ((y)<(min)? min: ((y)>(max)? max: (y))) /* decide if defrag is needed, and at what CPU effort to invest in it */ -void computeDefragCycles() { +void computeDefragCycles(void) { size_t frag_bytes; float frag_pct = getAllocatorFragmentation(&frag_bytes); /* If we're not already running, and below the threshold, exit. */ diff --git a/src/eval.c b/src/eval.c index 8ae3061ca..eb4b52936 100644 --- a/src/eval.c +++ b/src/eval.c @@ -650,15 +650,15 @@ NULL } } -unsigned long evalMemory() { +unsigned long evalMemory(void) { return luaMemory(lctx.lua); } -dict* evalScriptsDict() { +dict* evalScriptsDict(void) { return lctx.lua_scripts; } -unsigned long evalScriptsMemory() { +unsigned long evalScriptsMemory(void) { return lctx.lua_scripts_mem + dictMemUsage(lctx.lua_scripts) + dictSize(lctx.lua_scripts) * sizeof(luaScript); @@ -688,7 +688,7 @@ void ldbFlushLog(list *log) { listDelNode(log,ln); } -int ldbIsEnabled(){ +int ldbIsEnabled(void){ return ldb.active && ldb.step; } diff --git a/src/evict.c b/src/evict.c index 41712b926..4ca9f62ed 100644 --- a/src/evict.c +++ b/src/evict.c @@ -494,7 +494,7 @@ static int isSafeToPerformEvictions(void) { } /* Algorithm for converting tenacity (0-100) to a time limit. */ -static unsigned long evictionTimeLimitUs() { +static unsigned long evictionTimeLimitUs(void) { serverAssert(server.maxmemory_eviction_tenacity >= 0); serverAssert(server.maxmemory_eviction_tenacity <= 100); diff --git a/src/function_lua.c b/src/function_lua.c index ca89818d8..91bb5cd67 100644 --- a/src/function_lua.c +++ b/src/function_lua.c @@ -420,7 +420,7 @@ static int luaRegisterFunction(lua_State *lua) { } /* Initialize Lua engine, should be called once on start. */ -int luaEngineInitEngine() { +int luaEngineInitEngine(void) { luaEngineCtx *lua_engine_ctx = zmalloc(sizeof(*lua_engine_ctx)); lua_engine_ctx->lua = lua_open(); diff --git a/src/functions.c b/src/functions.c index c60d40d3c..f5738ba79 100644 --- a/src/functions.c +++ b/src/functions.c @@ -212,12 +212,12 @@ void functionsLibCtxSwapWithCurrent(functionsLibCtx *new_lib_ctx) { } /* return the current functions ctx */ -functionsLibCtx* functionsLibCtxGetCurrent() { +functionsLibCtx* functionsLibCtxGetCurrent(void) { return curr_functions_lib_ctx; } /* Create a new functions ctx */ -functionsLibCtx* functionsLibCtxCreate() { +functionsLibCtx* functionsLibCtxCreate(void) { functionsLibCtx *ret = zmalloc(sizeof(functionsLibCtx)); ret->libraries = dictCreate(&librariesDictType); ret->functions = dictCreate(&functionDictType); @@ -1075,7 +1075,7 @@ void functionLoadCommand(client *c) { } /* Return memory usage of all the engines combine */ -unsigned long functionsMemory() { +unsigned long functionsMemory(void) { dictIterator *iter = dictGetIterator(engines); dictEntry *entry = NULL; size_t engines_nemory = 0; @@ -1090,7 +1090,7 @@ unsigned long functionsMemory() { } /* Return memory overhead of all the engines combine */ -unsigned long functionsMemoryOverhead() { +unsigned long functionsMemoryOverhead(void) { size_t memory_overhead = dictMemUsage(engines); memory_overhead += dictMemUsage(curr_functions_lib_ctx->functions); memory_overhead += sizeof(functionsLibCtx); @@ -1101,15 +1101,15 @@ unsigned long functionsMemoryOverhead() { } /* Returns the number of functions */ -unsigned long functionsNum() { +unsigned long functionsNum(void) { return dictSize(curr_functions_lib_ctx->functions); } -unsigned long functionsLibNum() { +unsigned long functionsLibNum(void) { return dictSize(curr_functions_lib_ctx->libraries); } -dict* functionsLibGet() { +dict* functionsLibGet(void) { return curr_functions_lib_ctx->libraries; } @@ -1119,7 +1119,7 @@ size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx) { /* Initialize engine data structures. * Should be called once on server initialization */ -int functionsInit() { +int functionsInit(void) { engines = dictCreate(&engineDictType); if (luaEngineInitEngine() != C_OK) { diff --git a/src/functions.h b/src/functions.h index 40716dbc7..26e45babc 100644 --- a/src/functions.h +++ b/src/functions.h @@ -110,14 +110,14 @@ struct functionLibInfo { int functionsRegisterEngine(const char *engine_name, engine *engine_ctx); sds functionsCreateWithLibraryCtx(sds code, int replace, sds* err, functionsLibCtx *lib_ctx); -unsigned long functionsMemory(); -unsigned long functionsMemoryOverhead(); -unsigned long functionsNum(); -unsigned long functionsLibNum(); -dict* functionsLibGet(); +unsigned long functionsMemory(void); +unsigned long functionsMemoryOverhead(void); +unsigned long functionsNum(void); +unsigned long functionsLibNum(void); +dict* functionsLibGet(void); size_t functionsLibCtxfunctionsLen(functionsLibCtx *functions_ctx); -functionsLibCtx* functionsLibCtxGetCurrent(); -functionsLibCtx* functionsLibCtxCreate(); +functionsLibCtx* functionsLibCtxGetCurrent(void); +functionsLibCtx* functionsLibCtxCreate(void); void functionsLibCtxClearCurrent(int async); void functionsLibCtxFree(functionsLibCtx *lib_ctx); void functionsLibCtxClear(functionsLibCtx *lib_ctx); @@ -125,7 +125,7 @@ void functionsLibCtxSwapWithCurrent(functionsLibCtx *lib_ctx); int functionLibCreateFunction(sds name, void *function, functionLibInfo *li, sds desc, uint64_t f_flags, sds *err); -int luaEngineInitEngine(); -int functionsInit(); +int luaEngineInitEngine(void); +int functionsInit(void); #endif /* __FUNCTIONS_H_ */ diff --git a/src/lazyfree.c b/src/lazyfree.c index a44ad2df4..8ac55f777 100644 --- a/src/lazyfree.c +++ b/src/lazyfree.c @@ -82,7 +82,7 @@ size_t lazyfreeGetFreedObjectsCount(void) { return aux; } -void lazyfreeResetStats() { +void lazyfreeResetStats(void) { atomicSet(lazyfreed_objects,0); } diff --git a/src/listpack.c b/src/listpack.c index f7c867f2e..ecc7e9f6f 100644 --- a/src/listpack.c +++ b/src/listpack.c @@ -1693,7 +1693,7 @@ char *mixlist[] = {"hello", "foo", "quux", "1024"}; char *intlist[] = {"4294967296", "-100", "100", "128000", "non integer", "much much longer non integer"}; -static unsigned char *createList() { +static unsigned char *createList(void) { unsigned char *lp = lpNew(0); lp = lpAppend(lp, (unsigned char*)mixlist[1], strlen(mixlist[1])); lp = lpAppend(lp, (unsigned char*)mixlist[2], strlen(mixlist[2])); @@ -1702,7 +1702,7 @@ static unsigned char *createList() { return lp; } -static unsigned char *createIntList() { +static unsigned char *createIntList(void) { unsigned char *lp = lpNew(0); lp = lpAppend(lp, (unsigned char*)intlist[2], strlen(intlist[2])); lp = lpAppend(lp, (unsigned char*)intlist[3], strlen(intlist[3])); diff --git a/src/module.c b/src/module.c index 77256feae..561677e7e 100644 --- a/src/module.c +++ b/src/module.c @@ -789,7 +789,7 @@ int RM_GetApi(const char *funcname, void **targetPtrPtr) { return REDISMODULE_OK; } -void modulePostExecutionUnitOperations() { +void modulePostExecutionUnitOperations(void) { if (server.execution_nesting) return; @@ -2276,7 +2276,7 @@ uint64_t RM_MonotonicMicroseconds(void) { } /* Return the current UNIX time in microseconds */ -ustime_t RM_Microseconds() { +ustime_t RM_Microseconds(void) { return ustime(); } @@ -2286,7 +2286,7 @@ ustime_t RM_Microseconds() { * key space notification, causing a module to execute a RedisModule_Call, * causing another notification, etc. * It makes sense that all this callbacks would use the same clock. */ -ustime_t RM_CachedMicroseconds() { +ustime_t RM_CachedMicroseconds(void) { return server.ustime; } @@ -3913,7 +3913,7 @@ int RM_GetContextFlags(RedisModuleCtx *ctx) { * garbage collection tasks, or that do writes and replicate such writes * periodically in timer callbacks or other periodic callbacks. */ -int RM_AvoidReplicaTraffic() { +int RM_AvoidReplicaTraffic(void) { return !!(isPausedActionsWithUpdate(PAUSE_ACTION_REPLICA)); } @@ -4023,7 +4023,7 @@ RedisModuleKey *RM_OpenKey(RedisModuleCtx *ctx, robj *keyname, int mode) { * // REDISMODULE_OPEN_KEY_NOTOUCH is not supported * } */ -int RM_GetOpenKeyModesAll() { +int RM_GetOpenKeyModesAll(void) { return _REDISMODULE_OPEN_KEY_ALL; } @@ -6950,7 +6950,7 @@ void moduleRDBLoadError(RedisModuleIO *io) { /* Returns 0 if there's at least one registered data type that did not declare * REDISMODULE_OPTIONS_HANDLE_IO_ERRORS, in which case diskless loading should * be avoided since it could cause data loss. */ -int moduleAllDatatypesHandleErrors() { +int moduleAllDatatypesHandleErrors(void) { dictIterator *di = dictGetIterator(modules); dictEntry *de; @@ -6970,7 +6970,7 @@ int moduleAllDatatypesHandleErrors() { /* Returns 0 if module did not declare REDISMODULE_OPTIONS_HANDLE_REPL_ASYNC_LOAD, in which case * diskless async loading should be avoided because module doesn't know there can be traffic during * database full resynchronization. */ -int moduleAllModulesHandleReplAsyncLoad() { +int moduleAllModulesHandleReplAsyncLoad(void) { dictIterator *di = dictGetIterator(modules); dictEntry *de; @@ -8418,7 +8418,7 @@ void RM_FreeThreadSafeContext(RedisModuleCtx *ctx) { zfree(ctx); } -void moduleGILAfterLock() { +void moduleGILAfterLock(void) { /* We should never get here if we already inside a module * code block which already opened a context. */ serverAssert(server.execution_nesting == 0); @@ -8454,7 +8454,7 @@ int RM_ThreadSafeContextTryLock(RedisModuleCtx *ctx) { return REDISMODULE_OK; } -void moduleGILBeforeUnlock() { +void moduleGILBeforeUnlock(void) { /* We should never get here if we already inside a module * code block which already opened a context, except * the bump-up from moduleGILAcquired. */ @@ -8569,7 +8569,7 @@ int RM_SubscribeToKeyspaceEvents(RedisModuleCtx *ctx, int types, RedisModuleNoti return REDISMODULE_OK; } -void firePostExecutionUnitJobs() { +void firePostExecutionUnitJobs(void) { /* Avoid propagation of commands. * In that way, postExecutionUnitOperations will prevent * recursive calls to firePostExecutionUnitJobs. @@ -8622,7 +8622,7 @@ int RM_AddPostNotificationJob(RedisModuleCtx *ctx, RedisModulePostNotificationJo /* Get the configured bitmap of notify-keyspace-events (Could be used * for additional filtering in RedisModuleNotificationFunc) */ -int RM_GetNotifyKeyspaceEvents() { +int RM_GetNotifyKeyspaceEvents(void) { return server.notify_keyspace_events; } @@ -9337,7 +9337,7 @@ int RM_EventLoopAddOneShot(RedisModuleEventLoopOneShotFunc func, void *user_data /* This function will check the moduleEventLoopOneShots queue in order to * call the callback for the registered oneshot events. */ -static void eventLoopHandleOneShotEvents() { +static void eventLoopHandleOneShotEvents(void) { pthread_mutex_lock(&moduleEventLoopMutex); if (moduleEventLoopOneShots) { while (listLength(moduleEventLoopOneShots)) { @@ -10438,7 +10438,7 @@ int RM_ExportSharedAPI(RedisModuleCtx *ctx, const char *apiname, void *func) { * * Here is an example: * - * int ... myCommandImplementation() { + * int ... myCommandImplementation(void) { * if (getExternalAPIs() == 0) { * reply with an error here if we cannot have the APIs * } @@ -10771,7 +10771,7 @@ size_t RM_MallocSizeDict(RedisModuleDict* dict) { * * Exactly 1 - Memory limit reached. * * Greater 1 - More memory used than the configured limit. */ -float RM_GetUsedMemoryRatio(){ +float RM_GetUsedMemoryRatio(void){ float level; getMaxmemoryState(NULL, NULL, NULL, &level); return level; @@ -10810,7 +10810,7 @@ static void moduleScanCallback(void *privdata, const dictEntry *de) { } /* Create a new cursor to be used with RedisModule_Scan */ -RedisModuleScanCursor *RM_ScanCursorCreate() { +RedisModuleScanCursor *RM_ScanCursorCreate(void) { RedisModuleScanCursor* cursor = zmalloc(sizeof(*cursor)); cursor->cursor = 0; cursor->done = 0; @@ -13068,7 +13068,7 @@ int RM_GetLFU(RedisModuleKey *key, long long *lfu_freq) { * // REDISMODULE_OPTIONS_ALLOW_NESTED_KEYSPACE_NOTIFICATIONS is not supported * } */ -int RM_GetModuleOptionsAll() { +int RM_GetModuleOptionsAll(void) { return _REDISMODULE_OPTIONS_FLAGS_NEXT - 1; } @@ -13085,7 +13085,7 @@ int RM_GetModuleOptionsAll() { * // REDISMODULE_CTX_FLAGS_MULTI is not supported * } */ -int RM_GetContextFlagsAll() { +int RM_GetContextFlagsAll(void) { return _REDISMODULE_CTX_FLAGS_NEXT - 1; } @@ -13102,7 +13102,7 @@ int RM_GetContextFlagsAll() { * // REDISMODULE_NOTIFY_LOADED is not supported * } */ -int RM_GetKeyspaceNotificationFlagsAll() { +int RM_GetKeyspaceNotificationFlagsAll(void) { return _REDISMODULE_NOTIFY_NEXT - 1; } @@ -13110,7 +13110,7 @@ int RM_GetKeyspaceNotificationFlagsAll() { * Return the redis version in format of 0x00MMmmpp. * Example for 6.0.7 the return value will be 0x00060007. */ -int RM_GetServerVersion() { +int RM_GetServerVersion(void) { return REDIS_VERSION_NUM; } @@ -13119,7 +13119,7 @@ int RM_GetServerVersion() { * You can use that when calling RM_CreateDataType to know which fields of * RedisModuleTypeMethods are gonna be supported and which will be ignored. */ -int RM_GetTypeMethodVersion() { +int RM_GetTypeMethodVersion(void) { return REDISMODULE_TYPE_METHOD_VERSION; } diff --git a/src/monotonic.c b/src/monotonic.c index 608fa351c..1d71962f3 100644 --- a/src/monotonic.c +++ b/src/monotonic.c @@ -32,11 +32,11 @@ static char monotonic_info_string[32]; static long mono_ticksPerMicrosecond = 0; -static monotime getMonotonicUs_x86() { +static monotime getMonotonicUs_x86(void) { return __rdtsc() / mono_ticksPerMicrosecond; } -static void monotonicInit_x86linux() { +static void monotonicInit_x86linux(void) { const int bufflen = 256; char buf[bufflen]; regex_t cpuGhzRegex, constTscRegex; @@ -99,24 +99,24 @@ static void monotonicInit_x86linux() { static long mono_ticksPerMicrosecond = 0; /* Read the clock value. */ -static inline uint64_t __cntvct() { +static inline uint64_t __cntvct(void) { uint64_t virtual_timer_value; __asm__ volatile("mrs %0, cntvct_el0" : "=r"(virtual_timer_value)); return virtual_timer_value; } /* Read the Count-timer Frequency. */ -static inline uint32_t cntfrq_hz() { +static inline uint32_t cntfrq_hz(void) { uint64_t virtual_freq_value; __asm__ volatile("mrs %0, cntfrq_el0" : "=r"(virtual_freq_value)); return (uint32_t)virtual_freq_value; /* top 32 bits are reserved */ } -static monotime getMonotonicUs_aarch64() { +static monotime getMonotonicUs_aarch64(void) { return __cntvct() / mono_ticksPerMicrosecond; } -static void monotonicInit_aarch64() { +static void monotonicInit_aarch64(void) { mono_ticksPerMicrosecond = (long)cntfrq_hz() / 1000L / 1000L; if (mono_ticksPerMicrosecond == 0) { fprintf(stderr, "monotonic: aarch64, unable to determine clock rate"); @@ -130,7 +130,7 @@ static void monotonicInit_aarch64() { #endif -static monotime getMonotonicUs_posix() { +static monotime getMonotonicUs_posix(void) { /* clock_gettime() is specified in POSIX.1b (1993). Even so, some systems * did not support this until much later. CLOCK_MONOTONIC is technically * optional and may not be supported - but it appears to be universal. @@ -140,7 +140,7 @@ static monotime getMonotonicUs_posix() { return ((uint64_t)ts.tv_sec) * 1000000 + ts.tv_nsec / 1000; } -static void monotonicInit_posix() { +static void monotonicInit_posix(void) { /* Ensure that CLOCK_MONOTONIC is supported. This should be supported * on any reasonably current OS. If the assertion below fails, provide * an appropriate alternate implementation. */ @@ -155,7 +155,7 @@ static void monotonicInit_posix() { -const char * monotonicInit() { +const char * monotonicInit(void) { #if defined(USE_PROCESSOR_CLOCK) && defined(__x86_64__) && defined(__linux__) if (getMonotonicUs == NULL) monotonicInit_x86linux(); #endif @@ -169,11 +169,11 @@ const char * monotonicInit() { return monotonic_info_string; } -const char *monotonicInfoString() { +const char *monotonicInfoString(void) { return monotonic_info_string; } -monotonic_clock_type monotonicGetType() { +monotonic_clock_type monotonicGetType(void) { if (getMonotonicUs == getMonotonicUs_posix) return MONOTONIC_CLOCK_POSIX; return MONOTONIC_CLOCK_HW; diff --git a/src/monotonic.h b/src/monotonic.h index 32cf70638..b465f90b1 100644 --- a/src/monotonic.h +++ b/src/monotonic.h @@ -33,13 +33,13 @@ typedef enum monotonic_clock_type { * needs to be called once, it may be called additional times without impact. * Returns a printable string indicating the type of clock initialized. * (The returned string is static and doesn't need to be freed.) */ -const char *monotonicInit(); +const char *monotonicInit(void); /* Return a string indicating the type of monotonic clock being used. */ -const char *monotonicInfoString(); +const char *monotonicInfoString(void); /* Return the type of monotonic clock being used. */ -monotonic_clock_type monotonicGetType(); +monotonic_clock_type monotonicGetType(void); /* Functions to measure elapsed time. Example: * monotime myTimer; diff --git a/src/networking.c b/src/networking.c index f8fb6bee2..25d2b4c34 100644 --- a/src/networking.c +++ b/src/networking.c @@ -3981,7 +3981,7 @@ void updatePausedActions(void) { /* Unblock all paused clients (ones that where blocked by BLOCKED_POSTPONE (possibly in processCommand). * This means they'll get re-processed in beforeSleep, and may get paused again if needed. */ -void unblockPostponedClients() { +void unblockPostponedClients(void) { listNode *ln; listIter li; listRewind(server.postponed_clients, &li); diff --git a/src/pubsub.c b/src/pubsub.c index 2bbe40380..ed7350843 100644 --- a/src/pubsub.c +++ b/src/pubsub.c @@ -207,12 +207,12 @@ void addReplyPubsubPatUnsubscribed(client *c, robj *pattern) { *----------------------------------------------------------------------------*/ /* Return the number of pubsub channels + patterns is handled. */ -int serverPubsubSubscriptionCount() { +int serverPubsubSubscriptionCount(void) { return dictSize(server.pubsub_channels) + dictSize(server.pubsub_patterns); } /* Return the number of pubsub shard level channels is handled. */ -int serverPubsubShardSubscriptionCount() { +int serverPubsubShardSubscriptionCount(void) { return dictSize(server.pubsubshard_channels); } diff --git a/src/rand.c b/src/rand.c index 09b0508f1..e1e98e63b 100644 --- a/src/rand.c +++ b/src/rand.c @@ -68,7 +68,7 @@ static uint32_t x[3] = { X0, X1, X2 }, a[3] = { A0, A1, A2 }, c = C; static void next(void); -int32_t redisLrand48() { +int32_t redisLrand48(void) { next(); return (((int32_t)x[2] << (N - 1)) + (x[1] >> 1)); } diff --git a/src/rand.h b/src/rand.h index 1dce3e8b0..9884915a9 100644 --- a/src/rand.h +++ b/src/rand.h @@ -30,7 +30,7 @@ #ifndef REDIS_RANDOM_H #define REDIS_RANDOM_H -int32_t redisLrand48(); +int32_t redisLrand48(void); void redisSrand48(int32_t seedval); #define REDIS_LRAND48_MAX INT32_MAX diff --git a/src/redis-benchmark.c b/src/redis-benchmark.c index 95f54539c..2eb689e9f 100644 --- a/src/redis-benchmark.c +++ b/src/redis-benchmark.c @@ -192,7 +192,7 @@ static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask); static void createMissingClients(client c); static benchmarkThread *createBenchmarkThread(int index); static void freeBenchmarkThread(benchmarkThread *thread); -static void freeBenchmarkThreads(); +static void freeBenchmarkThreads(void); static void *execBenchmarkThread(void *ptr); static clusterNode *createClusterNode(char *ip, int port); static redisConfig *getRedisConfig(const char *ip, int port, @@ -201,7 +201,7 @@ static redisContext *getRedisContext(const char *ip, int port, const char *hostsocket); static void freeRedisConfig(redisConfig *cfg); static int fetchClusterSlotsConfiguration(client c); -static void updateClusterSlotsConfiguration(); +static void updateClusterSlotsConfiguration(void); int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData); @@ -958,7 +958,7 @@ static void showLatencyReport(void) { } } -static void initBenchmarkThreads() { +static void initBenchmarkThreads(void) { int i; if (config.threads) freeBenchmarkThreads(); config.threads = zmalloc(config.num_threads * sizeof(benchmarkThread*)); @@ -968,7 +968,7 @@ static void initBenchmarkThreads() { } } -static void startBenchmarkThreads() { +static void startBenchmarkThreads(void) { int i; for (i = 0; i < config.num_threads; i++) { benchmarkThread *t = config.threads[i]; @@ -1035,7 +1035,7 @@ static void freeBenchmarkThread(benchmarkThread *thread) { zfree(thread); } -static void freeBenchmarkThreads() { +static void freeBenchmarkThreads(void) { int i = 0; for (; i < config.num_threads; i++) { benchmarkThread *thread = config.threads[i]; @@ -1096,7 +1096,7 @@ static void freeClusterNode(clusterNode *node) { zfree(node); } -static void freeClusterNodes() { +static void freeClusterNodes(void) { int i = 0; for (; i < config.cluster_node_count; i++) { clusterNode *n = config.cluster_nodes[i]; @@ -1118,7 +1118,7 @@ static clusterNode **addClusterNode(clusterNode *node) { /* TODO: This should be refactored to use CLUSTER SLOTS, the migrating/importing * information is anyway not used. */ -static int fetchClusterConfiguration() { +static int fetchClusterConfiguration(void) { int success = 1; redisContext *ctx = NULL; redisReply *reply = NULL; @@ -1377,7 +1377,7 @@ cleanup: } /* Atomically update the new slots configuration. */ -static void updateClusterSlotsConfiguration() { +static void updateClusterSlotsConfiguration(void) { pthread_mutex_lock(&config.is_updating_slots_mutex); atomicSet(config.is_updating_slots, 1); int i; diff --git a/src/redis-cli.c b/src/redis-cli.c index ad2c79840..62eccf610 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -848,7 +848,7 @@ static size_t cliLegacyCountCommands(struct commandDocs *commands, sds version) /* Gets the server version string by calling INFO SERVER. * Stores the result in config.server_version. * When not connected, or not possible, returns NULL. */ -static sds cliGetServerVersion() { +static sds cliGetServerVersion(void) { static const char *key = "\nredis_version:"; redisReply *serverInfo = NULL; char *pos; @@ -1724,7 +1724,7 @@ static int cliConnect(int flags) { /* In cluster, if server replies ASK, we will redirect to a different node. * Before sending the real command, we need to send ASKING command first. */ -static int cliSendAsking() { +static int cliSendAsking(void) { redisReply *reply; config.cluster_send_asking = 0; @@ -2319,7 +2319,7 @@ static int cliReadReply(int output_raw_strings) { } /* Simultaneously wait for pubsub messages from redis and input on stdin. */ -static void cliWaitForMessagesOrStdin() { +static void cliWaitForMessagesOrStdin(void) { int show_info = config.output != OUTPUT_RAW && (isatty(STDOUT_FILENO) || getenv("FAKETTY")); int use_color = show_info && isColorTerm(); @@ -2965,7 +2965,7 @@ static int parseOptions(int argc, char **argv) { return i; } -static void parseEnv() { +static void parseEnv(void) { /* Set auth from env, but do not overwrite CLI arguments if passed */ char *auth = getenv(REDIS_CLI_AUTH_ENV); if (auth != NULL && config.conn_info.auth == NULL) { @@ -5870,7 +5870,7 @@ static clusterManagerNode * clusterManagerGetNodeWithMostKeysInSlot(list *nodes, * in the cluster. If there are multiple masters with the same smaller * number of replicas, one at random is returned. */ -static clusterManagerNode *clusterManagerNodeWithLeastReplicas() { +static clusterManagerNode *clusterManagerNodeWithLeastReplicas(void) { clusterManagerNode *node = NULL; int lowest_count = 0; listIter li; @@ -5889,7 +5889,7 @@ static clusterManagerNode *clusterManagerNodeWithLeastReplicas() { /* This function returns a random master node, return NULL if none */ -static clusterManagerNode *clusterManagerNodeMasterRandom() { +static clusterManagerNode *clusterManagerNodeMasterRandom(void) { int master_count = 0; int idx; listIter li; @@ -8391,7 +8391,7 @@ int sendReplconf(const char* arg1, const char* arg2) { return res; } -void sendCapa() { +void sendCapa(void) { sendReplconf("capa", "eof"); } diff --git a/src/redismodule.h b/src/redismodule.h index fff6ac9bc..049b0f340 100644 --- a/src/redismodule.h +++ b/src/redismodule.h @@ -976,7 +976,7 @@ REDISMODULE_API int (*RedisModule_GetSelectedDb)(RedisModuleCtx *ctx) REDISMODUL REDISMODULE_API int (*RedisModule_SelectDb)(RedisModuleCtx *ctx, int newid) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_KeyExists)(RedisModuleCtx *ctx, RedisModuleString *keyname) REDISMODULE_ATTR; REDISMODULE_API RedisModuleKey * (*RedisModule_OpenKey)(RedisModuleCtx *ctx, RedisModuleString *keyname, int mode) REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetOpenKeyModesAll)() REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetOpenKeyModesAll)(void) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_CloseKey)(RedisModuleKey *kp) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_KeyType)(RedisModuleKey *kp) REDISMODULE_ATTR; REDISMODULE_API size_t (*RedisModule_ValueLength)(RedisModuleKey *kp) REDISMODULE_ATTR; @@ -1098,7 +1098,7 @@ REDISMODULE_API int (*RedisModule_SetClientNameById)(uint64_t id, RedisModuleStr REDISMODULE_API int (*RedisModule_PublishMessage)(RedisModuleCtx *ctx, RedisModuleString *channel, RedisModuleString *message) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_PublishMessageShard)(RedisModuleCtx *ctx, RedisModuleString *channel, RedisModuleString *message) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_GetContextFlags)(RedisModuleCtx *ctx) REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_AvoidReplicaTraffic)() REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_AvoidReplicaTraffic)(void) REDISMODULE_ATTR; REDISMODULE_API void * (*RedisModule_PoolAlloc)(RedisModuleCtx *ctx, size_t bytes) REDISMODULE_ATTR; REDISMODULE_API RedisModuleType * (*RedisModule_CreateDataType)(RedisModuleCtx *ctx, const char *name, int encver, RedisModuleTypeMethods *typemethods) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_ModuleTypeSetValue)(RedisModuleKey *key, RedisModuleType *mt, void *value) REDISMODULE_ATTR; @@ -1201,17 +1201,17 @@ REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClientOnKeys)(Redi REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClientOnKeysWithFlags)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms, RedisModuleString **keys, int numkeys, void *privdata, int flags) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_SignalKeyAsReady)(RedisModuleCtx *ctx, RedisModuleString *key) REDISMODULE_ATTR; REDISMODULE_API RedisModuleString * (*RedisModule_GetBlockedClientReadyKey)(RedisModuleCtx *ctx) REDISMODULE_ATTR; -REDISMODULE_API RedisModuleScanCursor * (*RedisModule_ScanCursorCreate)() REDISMODULE_ATTR; +REDISMODULE_API RedisModuleScanCursor * (*RedisModule_ScanCursorCreate)(void) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_ScanCursorRestart)(RedisModuleScanCursor *cursor) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_ScanCursorDestroy)(RedisModuleScanCursor *cursor) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_Scan)(RedisModuleCtx *ctx, RedisModuleScanCursor *cursor, RedisModuleScanCB fn, void *privdata) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_ScanKey)(RedisModuleKey *key, RedisModuleScanCursor *cursor, RedisModuleScanKeyCB fn, void *privdata) REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetContextFlagsAll)() REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetModuleOptionsAll)() REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetKeyspaceNotificationFlagsAll)() REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetContextFlagsAll)(void) REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetModuleOptionsAll)(void) REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetKeyspaceNotificationFlagsAll)(void) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_IsSubEventSupported)(RedisModuleEvent event, uint64_t subevent) REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetServerVersion)() REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetTypeMethodVersion)() REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetServerVersion)(void) REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetTypeMethodVersion)(void) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_Yield)(RedisModuleCtx *ctx, int flags, const char *busy_reply) REDISMODULE_ATTR; REDISMODULE_API RedisModuleBlockedClient * (*RedisModule_BlockClient)(RedisModuleCtx *ctx, RedisModuleCmdFunc reply_callback, RedisModuleCmdFunc timeout_callback, void (*free_privdata)(RedisModuleCtx*,void*), long long timeout_ms) REDISMODULE_ATTR; REDISMODULE_API void * (*RedisModule_BlockClientGetPrivateData)(RedisModuleBlockedClient *blocked_client) REDISMODULE_ATTR; @@ -1234,7 +1234,7 @@ REDISMODULE_API void (*RedisModule_ThreadSafeContextUnlock)(RedisModuleCtx *ctx) REDISMODULE_API int (*RedisModule_SubscribeToKeyspaceEvents)(RedisModuleCtx *ctx, int types, RedisModuleNotificationFunc cb) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_AddPostNotificationJob)(RedisModuleCtx *ctx, RedisModulePostNotificationJobFunc callback, void *pd, void (*free_pd)(void*)) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_NotifyKeyspaceEvent)(RedisModuleCtx *ctx, int type, const char *event, RedisModuleString *key) REDISMODULE_ATTR; -REDISMODULE_API int (*RedisModule_GetNotifyKeyspaceEvents)() REDISMODULE_ATTR; +REDISMODULE_API int (*RedisModule_GetNotifyKeyspaceEvents)(void) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_BlockedClientDisconnected)(RedisModuleCtx *ctx) REDISMODULE_ATTR; REDISMODULE_API void (*RedisModule_RegisterClusterMessageReceiver)(RedisModuleCtx *ctx, uint8_t type, RedisModuleClusterMessageReceiver callback) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_SendClusterMessage)(RedisModuleCtx *ctx, const char *target_id, uint8_t type, const char *msg, uint32_t len) REDISMODULE_ATTR; @@ -1263,7 +1263,7 @@ REDISMODULE_API int (*RedisModule_Fork)(RedisModuleForkDoneHandler cb, void *use REDISMODULE_API void (*RedisModule_SendChildHeartbeat)(double progress) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_ExitFromChild)(int retcode) REDISMODULE_ATTR; REDISMODULE_API int (*RedisModule_KillForkChild)(int child_pid) REDISMODULE_ATTR; -REDISMODULE_API float (*RedisModule_GetUsedMemoryRatio)() REDISMODULE_ATTR; +REDISMODULE_API float (*RedisModule_GetUsedMemoryRatio)(void) REDISMODULE_ATTR; REDISMODULE_API size_t (*RedisModule_MallocSize)(void* ptr) REDISMODULE_ATTR; REDISMODULE_API size_t (*RedisModule_MallocUsableSize)(void *ptr) REDISMODULE_ATTR; REDISMODULE_API size_t (*RedisModule_MallocSizeString)(RedisModuleString* str) REDISMODULE_ATTR; diff --git a/src/replication.c b/src/replication.c index 260a405da..ca3287491 100644 --- a/src/replication.c +++ b/src/replication.c @@ -55,7 +55,7 @@ int cancelReplicationHandshake(int reconnect); int RDBGeneratedByReplication = 0; /* --------------------------- Utility functions ---------------------------- */ -static ConnectionType *connTypeOfReplication() { +static ConnectionType *connTypeOfReplication(void) { if (server.tls_replication) { return connectionTypeTls(); } @@ -1793,7 +1793,7 @@ void replicationCreateMasterClient(connection *conn, int dbid) { * master-replica synchronization: if it fails after multiple attempts * the replica cannot be considered reliable and exists with an * error. */ -void restartAOFAfterSYNC() { +void restartAOFAfterSYNC(void) { unsigned int tries, max_tries = 10; for (tries = 0; tries < max_tries; ++tries) { if (startAppendOnly() == C_OK) break; @@ -1810,7 +1810,7 @@ void restartAOFAfterSYNC() { } } -static int useDisklessLoad() { +static int useDisklessLoad(void) { /* compute boolean decision to use diskless load */ int enabled = server.repl_diskless_load == REPL_DISKLESS_LOAD_SWAPDB || (server.repl_diskless_load == REPL_DISKLESS_LOAD_WHEN_DB_EMPTY && dbTotalServerKeyCount()==0); @@ -1849,7 +1849,7 @@ void disklessLoadDiscardTempDb(redisDb *tempDb) { * we have no way to incrementally feed our replicas after that. * We want our replicas to resync with us as well, if we have any sub-replicas. * This is useful on readSyncBulkPayload in places where we just finished transferring db. */ -void replicationAttachToNewMaster() { +void replicationAttachToNewMaster(void) { /* Replica starts to apply data from new master, we must discard the cached * master structure. */ serverAssert(server.master == NULL); @@ -3993,7 +3993,7 @@ static client *findReplica(char *host, int port) { return NULL; } -const char *getFailoverStateString() { +const char *getFailoverStateString(void) { switch(server.failover_state) { case NO_FAILOVER: return "no-failover"; case FAILOVER_IN_PROGRESS: return "failover-in-progress"; @@ -4005,7 +4005,7 @@ const char *getFailoverStateString() { /* Resets the internal failover configuration, this needs * to be called after a failover either succeeds or fails * as it includes the client unpause. */ -void clearFailoverState() { +void clearFailoverState(void) { server.failover_end_time = 0; server.force_failover = 0; zfree(server.target_replica_host); diff --git a/src/script.c b/src/script.c index dd0bd3a58..70680e3ea 100644 --- a/src/script.c +++ b/src/script.c @@ -60,16 +60,16 @@ static void enterScriptTimedoutMode(scriptRunCtx *run_ctx) { blockingOperationStarts(); } -int scriptIsTimedout() { +int scriptIsTimedout(void) { return scriptIsRunning() && (curr_run_ctx->flags & SCRIPT_TIMEDOUT); } -client* scriptGetClient() { +client* scriptGetClient(void) { serverAssert(scriptIsRunning()); return curr_run_ctx->c; } -client* scriptGetCaller() { +client* scriptGetCaller(void) { serverAssert(scriptIsRunning()); return curr_run_ctx->original_client; } @@ -269,16 +269,16 @@ void scriptResetRun(scriptRunCtx *run_ctx) { } /* return true if a script is currently running */ -int scriptIsRunning() { +int scriptIsRunning(void) { return curr_run_ctx != NULL; } -const char* scriptCurrFunction() { +const char* scriptCurrFunction(void) { serverAssert(scriptIsRunning()); return curr_run_ctx->funcname; } -int scriptIsEval() { +int scriptIsEval(void) { serverAssert(scriptIsRunning()); return curr_run_ctx->flags & SCRIPT_EVAL_MODE; } @@ -571,7 +571,7 @@ error: incrCommandStatsOnError(cmd, ERROR_COMMAND_REJECTED); } -long long scriptRunDuration() { +long long scriptRunDuration(void) { serverAssert(scriptIsRunning()); return elapsedMs(curr_run_ctx->start_time); } diff --git a/src/script.h b/src/script.h index edcacd578..c487165d6 100644 --- a/src/script.h +++ b/src/script.h @@ -100,12 +100,12 @@ int scriptSetRepl(scriptRunCtx *r_ctx, int repl); void scriptCall(scriptRunCtx *r_ctx, sds *err); int scriptInterrupt(scriptRunCtx *r_ctx); void scriptKill(client *c, int is_eval); -int scriptIsRunning(); -const char* scriptCurrFunction(); -int scriptIsEval(); -int scriptIsTimedout(); -client* scriptGetClient(); -client* scriptGetCaller(); -long long scriptRunDuration(); +int scriptIsRunning(void); +const char* scriptCurrFunction(void); +int scriptIsEval(void); +int scriptIsTimedout(void); +client* scriptGetClient(void); +client* scriptGetCaller(void); +long long scriptRunDuration(void); #endif /* __SCRIPT_H_ */ diff --git a/src/sentinel.c b/src/sentinel.c index 3d5c3861c..326def135 100644 --- a/src/sentinel.c +++ b/src/sentinel.c @@ -1740,7 +1740,7 @@ const char *sentinelCheckCreateInstanceErrors(int role) { } /* init function for server.sentinel_config */ -void initializeSentinelConfig() { +void initializeSentinelConfig(void) { server.sentinel_config = zmalloc(sizeof(struct sentinelConfig)); server.sentinel_config->monitor_cfg = listCreate(); server.sentinel_config->pre_monitor_cfg = listCreate(); @@ -1751,7 +1751,7 @@ void initializeSentinelConfig() { } /* destroy function for server.sentinel_config */ -void freeSentinelConfig() { +void freeSentinelConfig(void) { /* release these three config queues since we will not use it anymore */ listRelease(server.sentinel_config->pre_monitor_cfg); listRelease(server.sentinel_config->monitor_cfg); @@ -3179,7 +3179,7 @@ void sentinelSendPeriodicCommands(sentinelRedisInstance *ri) { /* =========================== SENTINEL command ============================= */ -const char* getLogLevel() { +const char* getLogLevel(void) { switch (server.verbosity) { case LL_DEBUG: return "debug"; case LL_VERBOSE: return "verbose"; diff --git a/src/server.c b/src/server.c index fff6c7082..381edabc6 100644 --- a/src/server.c +++ b/src/server.c @@ -656,11 +656,11 @@ const char *strChildType(int type) { /* Return true if there are active children processes doing RDB saving, * AOF rewriting, or some side process spawned by a loaded module. */ -int hasActiveChildProcess() { +int hasActiveChildProcess(void) { return server.child_pid != -1; } -void resetChildState() { +void resetChildState(void) { server.child_type = CHILD_TYPE_NONE; server.child_pid = -1; server.stat_current_cow_peak = 0; @@ -682,7 +682,7 @@ int isMutuallyExclusiveChildType(int type) { } /* Returns true when we're inside a long command that yielded to the event loop. */ -int isInsideYieldingLongCommand() { +int isInsideYieldingLongCommand(void) { return scriptIsTimedout() || server.busy_module_yield_flags; } @@ -1148,7 +1148,7 @@ void enterExecutionUnit(int update_cached_time, long long us) { } } -void exitExecutionUnit() { +void exitExecutionUnit(void) { --server.execution_nesting; } @@ -1204,7 +1204,7 @@ void checkChildrenDone(void) { } /* Called from serverCron and cronUpdateMemoryStats to update cached memory metrics. */ -void cronUpdateMemoryStats() { +void cronUpdateMemoryStats(void) { /* Record the max memory used since the server was started. */ if (zmalloc_used_memory() > server.stat_peak_memory) server.stat_peak_memory = zmalloc_used_memory(); @@ -1518,14 +1518,14 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) { } -void blockingOperationStarts() { +void blockingOperationStarts(void) { if(!server.blocking_op_nesting++){ updateCachedTime(0); server.blocked_last_cron = server.mstime; } } -void blockingOperationEnds() { +void blockingOperationEnds(void) { if(!(--server.blocking_op_nesting)){ server.blocked_last_cron = 0; } @@ -1536,7 +1536,7 @@ void blockingOperationEnds() { * It attempts to do its duties at a similar rate as the configured server.hz, * and updates cronloops variable so that similarly to serverCron, the * run_with_period can be used. */ -void whileBlockedCron() { +void whileBlockedCron(void) { /* Here we may want to perform some cron jobs (normally done server.hz times * per second). */ @@ -1954,7 +1954,7 @@ void createSharedObjects(void) { shared.maxstring = sdsnew("maxstring"); } -void initServerClientMemUsageBuckets() { +void initServerClientMemUsageBuckets(void) { if (server.client_mem_usage_buckets) return; server.client_mem_usage_buckets = zmalloc(sizeof(clientMemUsageBucket)*CLIENT_MEM_USAGE_BUCKETS); @@ -1964,7 +1964,7 @@ void initServerClientMemUsageBuckets() { } } -void freeServerClientMemUsageBuckets() { +void freeServerClientMemUsageBuckets(void) { if (!server.client_mem_usage_buckets) return; for (int j = 0; j < CLIENT_MEM_USAGE_BUCKETS; j++) @@ -2717,7 +2717,7 @@ void initServer(void) { initServerClientMemUsageBuckets(); } -void initListeners() { +void initListeners(void) { /* Setup listeners from server config for TCP/TLS/Unix */ int conn_index; connListener *listener; @@ -2794,7 +2794,7 @@ void initListeners() { * Specifically, creation of threads due to a race bug in ld.so, in which * Thread Local Storage initialization collides with dlopen call. * see: https://sourceware.org/bugzilla/show_bug.cgi?id=19329 */ -void InitServerLast() { +void InitServerLast(void) { bioInit(); initThreadedIO(); set_jemalloc_bg_thread(server.jemalloc_bg_thread); @@ -3304,7 +3304,7 @@ void updateCommandLatencyHistogram(struct hdr_histogram **latency_histogram, int /* Handle the alsoPropagate() API to handle commands that want to propagate * multiple separated commands. Note that alsoPropagate() is not affected * by CLIENT_PREVENT_PROP flag. */ -static void propagatePendingCommands() { +static void propagatePendingCommands(void) { if (server.also_propagate.numops == 0) return; @@ -3360,7 +3360,7 @@ static void propagatePendingCommands() { * currently with respect to replication and post jobs, but in the future there might * be other considerations. So we basically want the `postUnitOperations` to trigger * after the entire chain finished. */ -void postExecutionUnitOperations() { +void postExecutionUnitOperations(void) { if (server.execution_nesting) return; @@ -6505,7 +6505,7 @@ void setupChildSignalHandlers(void) { * of the parent process, e.g. fd(socket or flock) etc. * should close the resources not used by the child process, so that if the * parent restarts it can bind/lock despite the child possibly still running. */ -void closeChildUnusedResourceAfterFork() { +void closeChildUnusedResourceAfterFork(void) { closeListeningSockets(0); if (server.cluster_enabled && server.cluster_config_file_lock_fd != -1) close(server.cluster_config_file_lock_fd); /* don't care if this fails */ diff --git a/src/server.h b/src/server.h index 222044ab9..bced3dbb8 100644 --- a/src/server.h +++ b/src/server.h @@ -1372,9 +1372,8 @@ typedef struct redisOp { /* Defines an array of Redis operations. There is an API to add to this * structure in an easy way. * - * redisOpArrayInit(); - * redisOpArrayAppend(); - * redisOpArrayFree(); + * int redisOpArrayAppend(redisOpArray *oa, int dbid, robj **argv, int argc, int target); + * void redisOpArrayFree(redisOpArray *oa); */ typedef struct redisOpArray { redisOp *ops; @@ -2472,14 +2471,14 @@ void moduleAcquireGIL(void); int moduleTryAcquireGIL(void); void moduleReleaseGIL(void); void moduleNotifyKeyspaceEvent(int type, const char *event, robj *key, int dbid); -void firePostExecutionUnitJobs(); +void firePostExecutionUnitJobs(void); void moduleCallCommandFilters(client *c); -void modulePostExecutionUnitOperations(); +void modulePostExecutionUnitOperations(void); void ModuleForkDoneHandler(int exitcode, int bysignal); int TerminateModuleForkChild(int child_pid, int wait); ssize_t rdbSaveModulesAux(rio *rdb, int when); -int moduleAllDatatypesHandleErrors(); -int moduleAllModulesHandleReplAsyncLoad(); +int moduleAllDatatypesHandleErrors(void); +int moduleAllModulesHandleReplAsyncLoad(void); sds modulesCollectInfo(sds info, dict *sections_dict, int for_crash_report, int sections); void moduleFireServerEvent(uint64_t eid, int subid, void *data); void processModuleLoadingProgressEvent(int is_aof); @@ -2607,11 +2606,11 @@ void unpauseActions(pause_purpose purpose); uint32_t isPausedActions(uint32_t action_bitmask); uint32_t isPausedActionsWithUpdate(uint32_t action_bitmask); void updatePausedActions(void); -void unblockPostponedClients(); +void unblockPostponedClients(void); void processEventsWhileBlocked(void); -void whileBlockedCron(); -void blockingOperationStarts(); -void blockingOperationEnds(); +void whileBlockedCron(void); +void blockingOperationStarts(void); +void blockingOperationEnds(void); int handleClientsWithPendingWrites(void); int handleClientsWithPendingWritesUsingThreads(void); int handleClientsWithPendingReadsUsingThreads(void); @@ -2777,7 +2776,7 @@ void replicationCron(void); void replicationStartPendingFork(void); void replicationHandleMasterDisconnection(void); void replicationCacheMaster(client *c); -void resizeReplicationBacklog(); +void resizeReplicationBacklog(void); void replicationSetMaster(char *ip, int port); void replicationUnsetMaster(void); void refreshGoodSlavesCount(void); @@ -2806,7 +2805,7 @@ void rdbPipeWriteHandlerConnRemoved(struct connection *conn); void clearFailoverState(void); void updateFailoverStatus(void); void abortFailover(const char *err); -const char *getFailoverStateString(); +const char *getFailoverStateString(void); /* Generic persistence functions */ void startLoadingFile(size_t size, char* filename, int rdbflags); @@ -2840,7 +2839,7 @@ void stopAppendOnly(void); int startAppendOnly(void); void backgroundRewriteDoneHandler(int exitcode, int bysignal); void killAppendOnlyChild(void); -void restartAOFAfterSYNC(); +void restartAOFAfterSYNC(void); void aofLoadManifestFromDisk(void); void aofOpenIfNeededOnServerStart(void); void aofManifestFree(aofManifest *am); @@ -2857,8 +2856,8 @@ void receiveChildInfo(void); /* Fork helpers */ int redisFork(int purpose); -int hasActiveChildProcess(); -void resetChildState(); +int hasActiveChildProcess(void); +void resetChildState(void); int isMutuallyExclusiveChildType(int type); /* acl.c -- Authentication related prototypes. */ @@ -2912,13 +2911,13 @@ int ACLLoadConfiguredUsers(void); robj *ACLDescribeUser(user *u); void ACLLoadUsersAtStartup(void); void addReplyCommandCategories(client *c, struct redisCommand *cmd); -user *ACLCreateUnlinkedUser(); +user *ACLCreateUnlinkedUser(void); void ACLFreeUserAndKillClients(user *u); void addACLLogEntry(client *c, int reason, int context, int argpos, sds username, sds object); sds getAclErrorMessage(int acl_res, user *user, struct redisCommand *cmd, sds errored_val, int verbose); void ACLUpdateDefaultUserPassword(sds password); sds genRedisInfoStringACLStats(sds info); -void ACLRecomputeCommandBitsFromCommandRulesAllUsers(); +void ACLRecomputeCommandBitsFromCommandRulesAllUsers(void); /* Sorted sets data type */ @@ -2990,7 +2989,7 @@ int zslLexValueLteMax(sds value, zlexrangespec *spec); /* Core functions */ int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *level); -size_t freeMemoryGetNotCountedMemory(); +size_t freeMemoryGetNotCountedMemory(void); int overMaxmemoryAfterAlloc(size_t moremem); uint64_t getCommandFlags(client *c); int processCommand(client *c); @@ -3011,11 +3010,11 @@ struct redisCommand *lookupCommandByCString(const char *s); struct redisCommand *lookupCommandOrOriginal(robj **argv, int argc); int commandCheckExistence(client *c, sds *err); int commandCheckArity(client *c, sds *err); -void startCommandExecution(); +void startCommandExecution(void); int incrCommandStatsOnError(struct redisCommand *cmd, int flags); void call(client *c, int flags); void alsoPropagate(int dbid, robj **argv, int argc, int target); -void postExecutionUnitOperations(); +void postExecutionUnitOperations(void); void redisOpArrayFree(redisOpArray *oa); void forceCommandPropagation(client *c, int flags); void preventCommandPropagation(client *c); @@ -3047,7 +3046,7 @@ void incrementErrorCount(const char *fullerr, size_t namelen); void closeListeningSockets(int unlink_unix_socket); void updateCachedTime(int update_daylight_info); void enterExecutionUnit(int update_cached_time, long long us); -void exitExecutionUnit(); +void exitExecutionUnit(void); void resetServerStats(void); void activeDefragCycle(void); unsigned int getLRUClock(void); @@ -3121,8 +3120,8 @@ int pubsubUnsubscribeAllPatterns(client *c, int notify); int pubsubPublishMessage(robj *channel, robj *message, int sharded); int pubsubPublishMessageAndPropagateToCluster(robj *channel, robj *message, int sharded); void addReplyPubsubMessage(client *c, robj *channel, robj *msg, robj *message_bulk); -int serverPubsubSubscriptionCount(); -int serverPubsubShardSubscriptionCount(); +int serverPubsubSubscriptionCount(void); +int serverPubsubShardSubscriptionCount(void); size_t pubsubMemOverhead(client *c); /* Keyspace events notification */ @@ -3176,12 +3175,12 @@ struct rewriteConfigState; /* Forward declaration to export API. */ int rewriteConfigRewriteLine(struct rewriteConfigState *state, const char *option, sds line, int force); void rewriteConfigMarkAsProcessed(struct rewriteConfigState *state, const char *option); int rewriteConfig(char *path, int force_write); -void initConfigValues(); +void initConfigValues(void); void removeConfig(sds name); -sds getConfigDebugInfo(); +sds getConfigDebugInfo(void); int allowProtectedAction(int config, client *c); -void initServerClientMemUsageBuckets(); -void freeServerClientMemUsageBuckets(); +void initServerClientMemUsageBuckets(void); +void freeServerClientMemUsageBuckets(void); /* Module Configuration */ typedef struct ModuleConfig ModuleConfig; @@ -3249,7 +3248,7 @@ robj *dbUnshareStringValue(redisDb *db, robj *key, robj *o); long long emptyData(int dbnum, int flags, void(callback)(dict*)); long long emptyDbStructure(redisDb *dbarray, int dbnum, int async, void(callback)(dict*)); void flushAllDataAndResetRDB(int flags); -long long dbTotalServerKeyCount(); +long long dbTotalServerKeyCount(void); redisDb *initTempDb(void); void discardTempDb(redisDb *tempDb, void(callback)(dict*)); @@ -3326,16 +3325,16 @@ sds luaCreateFunction(client *c, robj *body); void luaLdbLineHook(lua_State *lua, lua_Debug *ar); void freeLuaScriptsAsync(dict *lua_scripts); void freeFunctionsAsync(functionsLibCtx *lib_ctx); -int ldbIsEnabled(); +int ldbIsEnabled(void); void ldbLog(sds entry); void ldbLogRedisReply(char *reply); void sha1hex(char *digest, char *script, size_t len); -unsigned long evalMemory(); -dict* evalScriptsDict(); -unsigned long evalScriptsMemory(); +unsigned long evalMemory(void); +dict* evalScriptsDict(void); +unsigned long evalScriptsMemory(void); uint64_t evalGetCommandFlags(client *c, uint64_t orig_flags); uint64_t fcallGetCommandFlags(client *c, uint64_t orig_flags); -int isInsideYieldingLongCommand(); +int isInsideYieldingLongCommand(void); typedef struct luaScript { uint64_t flags; @@ -3691,7 +3690,7 @@ dict *genInfoSectionDict(robj **argv, int argc, char **defaults, int *out_all, i void releaseInfoSectionDict(dict *sec); sds genRedisInfoString(dict *section_dict, int all_sections, int everything); sds genModulesInfoString(sds info); -void applyWatchdogPeriod(); +void applyWatchdogPeriod(void); void watchdogScheduleSignal(int period); void serverLogHexDump(int level, char *descr, void *value, size_t len); int memtest_preserving_test(unsigned long *m, size_t bytes, int passes); diff --git a/src/socket.c b/src/socket.c index cecbd4288..0cfb2e4ec 100644 --- a/src/socket.c +++ b/src/socket.c @@ -464,7 +464,7 @@ int connRecvTimeout(connection *conn, long long ms) { return anetRecvTimeout(NULL, conn->fd, ms); } -int RedisRegisterConnectionTypeSocket() +int RedisRegisterConnectionTypeSocket(void) { return connTypeRegister(&CT_Socket); } diff --git a/src/tls.c b/src/tls.c index 6e8c8531d..94cba63f1 100644 --- a/src/tls.c +++ b/src/tls.c @@ -1062,13 +1062,13 @@ static const char *connTLSGetType(connection *conn_) { return CONN_TYPE_TLS; } -static int tlsHasPendingData() { +static int tlsHasPendingData(void) { if (!pending_list) return 0; return listLength(pending_list) > 0; } -static int tlsProcessPendingData() { +static int tlsProcessPendingData(void) { listIter li; listNode *ln; @@ -1151,13 +1151,13 @@ static ConnectionType CT_TLS = { .get_peer_cert = connTLSGetPeerCert, }; -int RedisRegisterConnectionTypeTLS() { +int RedisRegisterConnectionTypeTLS(void) { return connTypeRegister(&CT_TLS); } #else /* USE_OPENSSL */ -int RedisRegisterConnectionTypeTLS() { +int RedisRegisterConnectionTypeTLS(void) { serverLog(LL_VERBOSE, "Connection type %s not builtin", CONN_TYPE_TLS); return C_ERR; } diff --git a/src/unix.c b/src/unix.c index d85e200d3..73e56d4a0 100644 --- a/src/unix.c +++ b/src/unix.c @@ -200,7 +200,7 @@ static ConnectionType CT_Unix = { .process_pending_data = NULL, }; -int RedisRegisterConnectionTypeUnix() +int RedisRegisterConnectionTypeUnix(void) { return connTypeRegister(&CT_Unix); } diff --git a/src/ziplist.c b/src/ziplist.c index c3aa65633..c891625a9 100644 --- a/src/ziplist.c +++ b/src/ziplist.c @@ -1694,7 +1694,7 @@ unsigned int ziplistRandomPairsUnique(unsigned char *zl, unsigned int count, zip #define debug(f, ...) { if (DEBUG) printf(f, __VA_ARGS__); } -static unsigned char *createList() { +static unsigned char *createList(void) { unsigned char *zl = ziplistNew(); zl = ziplistPush(zl, (unsigned char*)"foo", 3, ZIPLIST_TAIL); zl = ziplistPush(zl, (unsigned char*)"quux", 4, ZIPLIST_TAIL); @@ -1703,7 +1703,7 @@ static unsigned char *createList() { return zl; } -static unsigned char *createIntList() { +static unsigned char *createIntList(void) { unsigned char *zl = ziplistNew(); char buf[32]; diff --git a/src/zmalloc.c b/src/zmalloc.c index 08ec64fc4..bbfa38651 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -656,7 +656,7 @@ void set_jemalloc_bg_thread(int enable) { je_mallctl("background_thread", NULL, 0, &val, 1); } -int jemalloc_purge() { +int jemalloc_purge(void) { /* return all unused (reserved) pages to the OS */ char tmp[32]; unsigned narenas = 0; @@ -682,7 +682,7 @@ void set_jemalloc_bg_thread(int enable) { ((void)(enable)); } -int jemalloc_purge() { +int jemalloc_purge(void) { return 0; } diff --git a/src/zmalloc.h b/src/zmalloc.h index 499cb7ec8..1ff66a635 100644 --- a/src/zmalloc.h +++ b/src/zmalloc.h @@ -120,7 +120,7 @@ void zmalloc_set_oom_handler(void (*oom_handler)(size_t)); size_t zmalloc_get_rss(void); int zmalloc_get_allocator_info(size_t *allocated, size_t *active, size_t *resident); void set_jemalloc_bg_thread(int enable); -int jemalloc_purge(); +int jemalloc_purge(void); size_t zmalloc_get_private_dirty(long pid); size_t zmalloc_get_smap_bytes_by_field(char *field, long pid); size_t zmalloc_get_memory_size(void); diff --git a/tests/modules/blockonkeys.c b/tests/modules/blockonkeys.c index 8f4353a55..bc3b6b1a4 100644 --- a/tests/modules/blockonkeys.c +++ b/tests/modules/blockonkeys.c @@ -21,7 +21,7 @@ typedef struct { static RedisModuleType *fsltype = NULL; -fsl_t *fsl_type_create() { +fsl_t *fsl_type_create(void) { fsl_t *o; o = RedisModule_Alloc(sizeof(*o)); o->length = 0; -- cgit v1.2.1