diff --git a/src/anet.c b/src/anet.c index 8dc06ca62e..340f3df17d 100644 --- a/src/anet.c +++ b/src/anet.c @@ -202,8 +202,8 @@ int anetKeepAlive(char *err, int fd, int interval) { if (idle < 10) idle = 10; // kernel expects at least 10 seconds if (idle > 10 * 24 * 60 * 60) idle = 10 * 24 * 60 * 60; // kernel expects at most 10 days - /* `TCP_KEEPIDLE`, `TCP_KEEPINTVL`, and `TCP_KEEPCNT` were not available on Solaris - * until version 11.4, but let's take a chance here. */ + /* `TCP_KEEPIDLE`, `TCP_KEEPINTVL`, and `TCP_KEEPCNT` were not available on Solaris + * until version 11.4, but let's take a chance here. */ #if defined(TCP_KEEPIDLE) && defined(TCP_KEEPINTVL) && defined(TCP_KEEPCNT) if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &idle, sizeof(idle))) { anetSetError(err, "setsockopt TCP_KEEPIDLE: %s\n", strerror(errno)); diff --git a/src/config.c b/src/config.c index eb1d8fc74e..46e804c42d 100644 --- a/src/config.c +++ b/src/config.c @@ -1359,9 +1359,9 @@ void rewriteConfigOctalOption(struct rewriteConfigState *state, /* Rewrite an unsigned number option. */ void rewriteConfigUnsignedOption(struct rewriteConfigState *state, - const char *option, - unsigned long long value, - unsigned long long defvalue) { + const char *option, + unsigned long long value, + unsigned long long defvalue) { int force = value != defvalue; sds line = sdscatprintf(sdsempty(), "%s %llu", option, value); @@ -3522,17 +3522,17 @@ void addModuleNumericConfig(const char *module_name, } void addModuleUnsignedNumericConfig(const char *module_name, - const char *name, - int flags, - void *privdata, - unsigned long long default_val, - int conf_flags, - unsigned long long lower, - unsigned long long upper) { + const char *name, + int flags, + void *privdata, + unsigned long long default_val, + int conf_flags, + unsigned long long lower, + unsigned long long upper) { sds config_name = sdscatfmt(sdsempty(), "%s.%s", module_name, name); unsigned long long config_dummy_address; standardConfig module_config = createULongLongConfig(config_name, NULL, flags | MODULE_CONFIG, lower, upper, - config_dummy_address, default_val, conf_flags, NULL, NULL); + config_dummy_address, default_val, conf_flags, NULL, NULL); module_config.data.numeric.config.ull = NULL; module_config.privdata = privdata; registerConfigValue(config_name, &module_config, 0); diff --git a/src/module.c b/src/module.c index 139a7c49bc..729d3dc3df 100644 --- a/src/module.c +++ b/src/module.c @@ -465,9 +465,9 @@ typedef int (*ValkeyModuleConfigSetNumericFunc)(const char *name, void *privdata, ValkeyModuleString **err); typedef int (*ValkeyModuleConfigSetUnsignedNumericFunc)(const char *name, - unsigned long long val, - void *privdata, - ValkeyModuleString **err); + unsigned long long val, + void *privdata, + ValkeyModuleString **err); typedef int (*ValkeyModuleConfigSetBoolFunc)(const char *name, int val, void *privdata, ValkeyModuleString **err); typedef int (*ValkeyModuleConfigSetEnumFunc)(const char *name, int val, void *privdata, ValkeyModuleString **err); /* Apply signature, identical to valkeymodule.h */ @@ -13033,15 +13033,15 @@ int VM_RegisterNumericConfig(ValkeyModuleCtx *ctx, * `CONFIG SET`, `CONFIG GET`, and `CONFIG REWRITE` commands. See * ValkeyModule_RegisterStringConfig for detailed information about configs. */ int VM_RegisterUnsignedNumericConfig(ValkeyModuleCtx *ctx, - const char *name, - unsigned long long default_val, - unsigned int flags, - unsigned long long min, - unsigned long long max, - ValkeyModuleConfigGetUnsignedNumericFunc getfn, - ValkeyModuleConfigSetUnsignedNumericFunc setfn, - ValkeyModuleConfigApplyFunc applyfn, - void *privdata) { + const char *name, + unsigned long long default_val, + unsigned int flags, + unsigned long long min, + unsigned long long max, + ValkeyModuleConfigGetUnsignedNumericFunc getfn, + ValkeyModuleConfigSetUnsignedNumericFunc setfn, + ValkeyModuleConfigApplyFunc applyfn, + void *privdata) { ValkeyModule *module = ctx->module; if (moduleConfigValidityCheck(module, name, flags, NUMERIC_CONFIG)) { return VALKEYMODULE_ERR; diff --git a/src/object.c b/src/object.c index 86eefe43a3..9c55f4164a 100644 --- a/src/object.c +++ b/src/object.c @@ -738,8 +738,8 @@ void dismissObject(robj *o, size_t size_hint) { /* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */ if (server.thp_enabled) return; - /* Currently we use zmadvise_dontneed only when we use jemalloc with Linux. - * so we avoid these pointless loops when they're not going to do anything. */ + /* Currently we use zmadvise_dontneed only when we use jemalloc with Linux. + * so we avoid these pointless loops when they're not going to do anything. */ #if defined(USE_JEMALLOC) && defined(__linux__) if (o->refcount != 1) return; switch (o->type) { diff --git a/src/server.c b/src/server.c index 5de0a123f2..14b8b3b8fa 100644 --- a/src/server.c +++ b/src/server.c @@ -6565,8 +6565,8 @@ void dismissMemoryInChild(void) { /* madvise(MADV_DONTNEED) may not work if Transparent Huge Pages is enabled. */ if (server.thp_enabled) return; - /* Currently we use zmadvise_dontneed only when we use jemalloc with Linux. - * so we avoid these pointless loops when they're not going to do anything. */ + /* Currently we use zmadvise_dontneed only when we use jemalloc with Linux. + * so we avoid these pointless loops when they're not going to do anything. */ #if defined(USE_JEMALLOC) && defined(__linux__) listIter li; listNode *ln; @@ -7011,7 +7011,7 @@ __attribute__((weak)) int main(int argc, char **argv) { } if (server.sentinel_mode) sentinelCheckConfigFile(); - /* Do system checks */ + /* Do system checks */ #ifdef __linux__ linuxMemoryWarnings(); sds err_msg = NULL; diff --git a/src/server.h b/src/server.h index a07ced401a..983c6989eb 100644 --- a/src/server.h +++ b/src/server.h @@ -3294,11 +3294,11 @@ sds keyspaceEventsFlagsToString(int flags); * to apply the configuration change even if the new config value is the same as \ * the old. */ -#define INTEGER_CONFIG 0 /* No flags means a simple integer configuration */ -#define MEMORY_CONFIG (1 << 0) /* Indicates if this value can be loaded as a memory value */ -#define PERCENT_CONFIG (1 << 1) /* Indicates if this value can be loaded as a percent (and stored as a negative int) */ -#define OCTAL_CONFIG (1 << 2) /* This value uses octal representation */ -#define UNSIGNED_CONFIG (1 << 3) /* This value uses unsigned representation */ +#define INTEGER_CONFIG 0 /* No flags means a simple integer configuration */ +#define MEMORY_CONFIG (1 << 0) /* Indicates if this value can be loaded as a memory value */ +#define PERCENT_CONFIG (1 << 1) /* Indicates if this value can be loaded as a percent (and stored as a negative int) */ +#define OCTAL_CONFIG (1 << 2) /* This value uses octal representation */ +#define UNSIGNED_CONFIG (1 << 3) /* This value uses unsigned representation */ /* Enum Configs contain an array of configEnum objects that match a string with an integer. */ typedef struct configEnum { @@ -3352,13 +3352,13 @@ void addModuleNumericConfig(const char *module_name, long long lower, long long upper); void addModuleUnsignedNumericConfig(const char *module_name, - const char *name, - int flags, - void *privdata, - unsigned long long default_val, - int conf_flags, - unsigned long long lower, - unsigned long long upper); + const char *name, + int flags, + void *privdata, + unsigned long long default_val, + int conf_flags, + unsigned long long lower, + unsigned long long upper); void addModuleConfigApply(list *module_configs, ModuleConfig *module_config); int moduleConfigApplyConfig(list *module_configs, const char **err, const char **err_arg_name); int getModuleBoolConfig(ModuleConfig *module_config); diff --git a/src/valkeymodule.h b/src/valkeymodule.h index 763cd476e5..75fb845c06 100644 --- a/src/valkeymodule.h +++ b/src/valkeymodule.h @@ -980,9 +980,9 @@ typedef int (*ValkeyModuleConfigSetNumericFunc)(const char *name, void *privdata, ValkeyModuleString **err); typedef int (*ValkeyModuleConfigSetUnsignedNumericFunc)(const char *name, - unsigned long long val, - void *privdata, - ValkeyModuleString **err); + unsigned long long val, + void *privdata, + ValkeyModuleString **err); typedef int (*ValkeyModuleConfigSetBoolFunc)(const char *name, int val, void *privdata, ValkeyModuleString **err); typedef int (*ValkeyModuleConfigSetEnumFunc)(const char *name, int val, void *privdata, ValkeyModuleString **err); typedef int (*ValkeyModuleConfigApplyFunc)(ValkeyModuleCtx *ctx, void *privdata, ValkeyModuleString **err); @@ -1715,15 +1715,15 @@ VALKEYMODULE_API int (*ValkeyModule_RegisterNumericConfig)(ValkeyModuleCtx *ctx, ValkeyModuleConfigApplyFunc applyfn, void *privdata) VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_RegisterUnsignedNumericConfig)(ValkeyModuleCtx *ctx, - const char *name, - unsigned long long default_val, - unsigned int flags, - unsigned long long min, - unsigned long long max, - ValkeyModuleConfigGetUnsignedNumericFunc getfn, - ValkeyModuleConfigSetUnsignedNumericFunc setfn, - ValkeyModuleConfigApplyFunc applyfn, - void *privdata) VALKEYMODULE_ATTR; + const char *name, + unsigned long long default_val, + unsigned int flags, + unsigned long long min, + unsigned long long max, + ValkeyModuleConfigGetUnsignedNumericFunc getfn, + ValkeyModuleConfigSetUnsignedNumericFunc setfn, + ValkeyModuleConfigApplyFunc applyfn, + void *privdata) VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_RegisterStringConfig)(ValkeyModuleCtx *ctx, const char *name, const char *default_val, diff --git a/tests/modules/moduleconfigs.c b/tests/modules/moduleconfigs.c index dfcc35e61d..6244595932 100644 --- a/tests/modules/moduleconfigs.c +++ b/tests/modules/moduleconfigs.c @@ -145,8 +145,8 @@ int registerBlockCheck(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc result = ValkeyModule_RegisterNumericConfig(ctx, "numeric", -1, VALKEYMODULE_CONFIG_DEFAULT, -5, 2000, getNumericConfigCommand, setNumericConfigCommand, longlongApplyFunc, &longval); response_ok |= (result == VALKEYMODULE_OK); - - result = ValkeyModule_RegisterUnsignedNumericConfig(ctx, "unsigned_numeric", 1, VALKEYMODULE_CONFIG_DEFAULT | VALKEYMODULE_CONFIG_UNSIGNED, 0, LLONG_MAX + 1000, getUnsignedNumericConfigCommand, setUnsignedNumericConfigCommand, unsignedlonglongApplyFunc, &mutable_ull_val); + + result = ValkeyModule_RegisterUnsignedNumericConfig(ctx, "unsigned_numeric", 1, VALKEYMODULE_CONFIG_DEFAULT | VALKEYMODULE_CONFIG_UNSIGNED, 0, LLONG_MAX * 1ULL + 1000, getUnsignedNumericConfigCommand, setUnsignedNumericConfigCommand, unsignedlonglongApplyFunc, &mutable_ull_val); response_ok |= (result == VALKEYMODULE_OK); result = ValkeyModule_LoadConfigs(ctx); @@ -196,7 +196,7 @@ int ValkeyModule_OnLoad(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int arg if (ValkeyModule_RegisterNumericConfig(ctx, "numeric", -1, VALKEYMODULE_CONFIG_DEFAULT, -5, 2000, getNumericConfigCommand, setNumericConfigCommand, longlongApplyFunc, &longval) == VALKEYMODULE_ERR) { return VALKEYMODULE_ERR; } - if (ValkeyModule_RegisterUnsignedNumericConfig(ctx, "unsigned_numeric", 1, VALKEYMODULE_CONFIG_DEFAULT | VALKEYMODULE_CONFIG_UNSIGNED, 0, LLONG_MAX + 1000, getUnsignedNumericConfigCommand, setUnsignedNumericConfigCommand, NULL, &mutable_ull_val) == VALKEYMODULE_ERR) { + if (ValkeyModule_RegisterUnsignedNumericConfig(ctx, "unsigned_numeric", 1, VALKEYMODULE_CONFIG_DEFAULT | VALKEYMODULE_CONFIG_UNSIGNED, 0, LLONG_MAX * 1ULL + 1000, getUnsignedNumericConfigCommand, setUnsignedNumericConfigCommand, NULL, &mutable_ull_val) == VALKEYMODULE_ERR) { return VALKEYMODULE_ERR; } size_t len;