diff --git a/src/module.c b/src/module.c index 42c9ab5973..3e5cdf4a3d 100644 --- a/src/module.c +++ b/src/module.c @@ -2254,16 +2254,17 @@ int moduleIsModuleCommand(void *module_handle, struct serverCommand *cmd) { return (cp->module == module_handle); } -/* ValkeyModule_UpdateRuntimeArgs can be used to update the values of module->loadmod - * so that the updated values can be saved into conf file once 'config rewrite' command - * is called - * One example can be found in file modules/moduleparameter.c +/* ValkeyModule_UpdateRuntimeArgs can be used to update the module argument values. + * The function parameter 'argc' indicates the number of updated arguments, and 'argv' + * represents the values of the updated arguments. + * Once 'CONFIG REWRITE' command is called, the updated argument values can be saved into conf file. + * One example can be found in file tests/modules/moduleparameter.c. * * Returns: * - VALKEYMODULE_OK on successfully updating. * - VALKEYMODULE_ERR on failure. */ -int VM_UpdateRuntimeArgs(ValkeyModuleCtx *ctx, int argc, ValkeyModuleString **argv) { +int VM_UpdateRuntimeArgs(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) { if (!ctx->module->onload) { return VALKEYMODULE_ERR; } diff --git a/src/valkeymodule.h b/src/valkeymodule.h index 1c25444972..7c3adfd477 100644 --- a/src/valkeymodule.h +++ b/src/valkeymodule.h @@ -967,7 +967,7 @@ VALKEYMODULE_API void (*ValkeyModule_SetModuleAttribs)(ValkeyModuleCtx *ctx, con VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_IsModuleNameBusy)(const char *name) VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_WrongArity)(ValkeyModuleCtx *ctx) VALKEYMODULE_ATTR; -VALKEYMODULE_API int (*ValkeyModule_UpdateRuntimeArgs)(ValkeyModuleCtx *ctx, int argc, ValkeyModuleString **argv) VALKEYMODULE_ATTR; +VALKEYMODULE_API int (*ValkeyModule_UpdateRuntimeArgs)(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_ReplyWithLongLong)(ValkeyModuleCtx *ctx, long long ll) VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_GetSelectedDb)(ValkeyModuleCtx *ctx) VALKEYMODULE_ATTR; VALKEYMODULE_API int (*ValkeyModule_SelectDb)(ValkeyModuleCtx *ctx, int newid) VALKEYMODULE_ATTR; diff --git a/tests/modules/moduleparameter.c b/tests/modules/moduleparameter.c index c71c751e7f..171c5e157e 100644 --- a/tests/modules/moduleparameter.c +++ b/tests/modules/moduleparameter.c @@ -5,7 +5,7 @@ #include int GET_HELLO(ValkeyModuleCtx *ctx, ValkeyModuleString **argv, int argc) { - ValkeyModule_UpdateRuntimeArgs(ctx, argc, argv); + ValkeyModule_UpdateRuntimeArgs(ctx, argv, argc); return ValkeyModule_ReplyWithSimpleString(ctx, "Module runtime args test"); }