Skip to content

Commit

Permalink
format code
Browse files Browse the repository at this point in the history
Signed-off-by: artikell <[email protected]>
  • Loading branch information
artikell committed Jan 12, 2025
1 parent 2c0d54e commit 6156c1c
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 57 deletions.
4 changes: 2 additions & 2 deletions src/anet.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
22 changes: 11 additions & 11 deletions src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions src/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/object.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 3 additions & 3 deletions src/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
24 changes: 12 additions & 12 deletions src/server.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions src/valkeymodule.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests/modules/moduleconfigs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 6156c1c

Please sign in to comment.