Repository: valkey-io/valkey
File: src/valkeymodule.h (C/C++)

Code before:
                                             ValkeyModuleRdbStream *stream,
                                             int flags) VALKEYMODULE_ATTR;

VALKEYMODULE_API int (*ValkeyModule_RegisterScriptingEngine)(ValkeyModuleCtx *module_ctx,
                                                             const char *engine_name,
                                                             ValkeyModuleScriptingEngineCtx *engine_ctx,
                                                             ValkeyModuleScriptingEngineMethods *engine_methods) VALKEYMODULE_ATTR;

VALKEYMODULE_API int (*ValkeyModule_UnregisterScriptingEngine)(ValkeyModuleCtx *module_ctx,
                                                               const char *engine_name) VALKEYMODULE_ATTR;

VALKEYMODULE_API ValkeyModuleScriptingEngineExecutionState (*ValkeyModule_GetFunctionExecutionState)(ValkeyModuleScriptingEngineServerRuntimeCtx *server_ctx) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerLog)(ValkeyModuleString *msg,
                                                                 int truncate) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerLogRespReplyStr)(const char *reply) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerLogRespReply)(ValkeyModuleCallReply *reply) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerFlushLogs)(void) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerProcessCommands)(int *client_disconnected,
                                                                             ValkeyModuleString **err) VALKEYMODULE_ATTR;

VALKEYMODULE_API int (*ValkeyModule_ACLCheckPrefixPermissions)(ValkeyModuleCtx *ctx,
                                                               const char *key,
                                                               size_t len,
                                                               unsigned int flags) VALKEYMODULE_ATTR;

#define ValkeyModule_IsAOFClient(id) ((id) == UINT64_MAX)
/* This is included inline inside each Valkey module. */
static int ValkeyModule_Init(ValkeyModuleCtx *ctx, const char *name, int ver, int apiver) VALKEYMODULE_ATTR_UNUSED;
static int ValkeyModule_Init(ValkeyModuleCtx *ctx, const char *name, int ver, int apiver) {
    void *getapifuncptr = ((void **)ctx)[0];
    ValkeyModule_GetApi = (int (*)(const char *, void *))(unsigned long)getapifuncptr;
    VALKEYMODULE_GET_API(Alloc);
    VALKEYMODULE_GET_API(TryAlloc);
    VALKEYMODULE_GET_API(Calloc);
    VALKEYMODULE_GET_API(TryCalloc);
    VALKEYMODULE_GET_API(Free);
    VALKEYMODULE_GET_API(Realloc);
    VALKEYMODULE_GET_API(TryRealloc);
    VALKEYMODULE_GET_API(Strdup);
    VALKEYMODULE_GET_API(CreateCommand);
    VALKEYMODULE_GET_API(GetCommand);
    VALKEYMODULE_GET_API(CreateSubcommand);
    VALKEYMODULE_GET_API(SetCommandInfo);
    VALKEYMODULE_GET_API(SetCommandACLCategories);
    VALKEYMODULE_GET_API(AddACLCategory);
    VALKEYMODULE_GET_API(SetModuleAttribs);

Review comment (security):
```suggestion
VALKEYMODULE_API int (*ValkeyModule_ACLCheckKeyPrefixPermissions)(ValkeyModuleCtx *ctx,
```
Minor preference to include key in the name.

Code after:
                                             int flags) VALKEYMODULE_ATTR;
VALKEYMODULE_API int (*ValkeyModule_RdbSave)(ValkeyModuleCtx *ctx,
                                             ValkeyModuleRdbStream *stream,
                                             int flags) VALKEYMODULE_ATTR;

VALKEYMODULE_API int (*ValkeyModule_RegisterScriptingEngine)(ValkeyModuleCtx *module_ctx,
                                                             const char *engine_name,
                                                             ValkeyModuleScriptingEngineCtx *engine_ctx,
                                                             ValkeyModuleScriptingEngineMethods *engine_methods) VALKEYMODULE_ATTR;

VALKEYMODULE_API int (*ValkeyModule_UnregisterScriptingEngine)(ValkeyModuleCtx *module_ctx,
                                                               const char *engine_name) VALKEYMODULE_ATTR;

VALKEYMODULE_API ValkeyModuleScriptingEngineExecutionState (*ValkeyModule_GetFunctionExecutionState)(ValkeyModuleScriptingEngineServerRuntimeCtx *server_ctx) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerLog)(ValkeyModuleString *msg,
                                                                 int truncate) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerLogRespReplyStr)(const char *reply) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerLogRespReply)(ValkeyModuleCallReply *reply) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerFlushLogs)(void) VALKEYMODULE_ATTR;

VALKEYMODULE_API void (*ValkeyModule_ScriptingEngineDebuggerProcessCommands)(int *client_disconnected,
                                                                             ValkeyModuleString **err) VALKEYMODULE_ATTR;

VALKEYMODULE_API int (*ValkeyModule_ACLCheckKeyPrefixPermissions)(ValkeyModuleUser *user,
                                                                  const char *key,
                                                                  size_t len,
                                                                  unsigned int flags) VALKEYMODULE_ATTR;

#define ValkeyModule_IsAOFClient(id) ((id) == UINT64_MAX)
/* This is included inline inside each Valkey module. */
static int ValkeyModule_Init(ValkeyModuleCtx *ctx, const char *name, int ver, int apiver) VALKEYMODULE_ATTR_UNUSED;
static int ValkeyModule_Init(ValkeyModuleCtx *ctx, const char *name, int ver, int apiver) {
    void *getapifuncptr = ((void **)ctx)[0];
    ValkeyModule_GetApi = (int (*)(const char *, void *))(unsigned long)getapifuncptr;
    VALKEYMODULE_GET_API(Alloc);
    VALKEYMODULE_GET_API(TryAlloc);
    VALKEYMODULE_GET_API(Calloc);
    VALKEYMODULE_GET_API(TryCalloc);
    VALKEYMODULE_GET_API(Free);
    VALKEYMODULE_GET_API(Realloc);
    VALKEYMODULE_GET_API(TryRealloc);
    VALKEYMODULE_GET_API(Strdup);
    VALKEYMODULE_GET_API(CreateCommand);
    VALKEYMODULE_GET_API(GetCommand);
    VALKEYMODULE_GET_API(CreateSubcommand);
    VALKEYMODULE_GET_API(SetCommandInfo);
    VALKEYMODULE_GET_API(SetCommandACLCategories);