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

Code before:
     * callback will be called with the script code, compiles it, and returns a
     * list of `ValkeyModuleScriptingEngineCompiledFunc` objects. */
    union {
        ValkeyModuleScriptingEngineCompileCodeFuncV1 compile_code_v1;
        ValkeyModuleScriptingEngineCompileCodeFunc compile_code;
    };
    /* Function callback to free the memory of a registered engine function. */
    ValkeyModuleScriptingEngineFreeFunctionFunc free_function;

    /* The callback function called when `FCALL` command is called on a function
     * registered in this engine. */
    ValkeyModuleScriptingEngineCallFunctionFunc call_function;

    /* Function callback to return memory overhead for a given function. */
    ValkeyModuleScriptingEngineGetFunctionMemoryOverheadFunc get_function_memory_overhead;

    /* The callback function used to reset the runtime environment used
     * by the scripting engine for EVAL scripts. */
    ValkeyModuleScriptingEngineResetEvalEnvFunc reset_eval_env;

    /* Function callback to get the used memory by the engine. */
    ValkeyModuleScriptingEngineGetMemoryInfoFunc get_memory_info;

} ValkeyModuleScriptingEngineMethodsV2;

#define ValkeyModuleScriptingEngineMethods ValkeyModuleScriptingEngineMethodsV2

/* ------------------------- End of common defines ------------------------ */

/* ----------- The rest of the defines are only for modules ----------------- */
#if !defined VALKEYMODULE_CORE || defined VALKEYMODULE_CORE_MODULE
/* Things defined for modules and core-modules. */

/* Macro definitions specific to individual compilers */
#ifndef VALKEYMODULE_ATTR_UNUSED
#ifdef __GNUC__
#define VALKEYMODULE_ATTR_UNUSED __attribute__((unused))
#else
#define VALKEYMODULE_ATTR_UNUSED
#endif
#endif

#ifndef VALKEYMODULE_ATTR_PRINTF
#ifdef __GNUC__
#define VALKEYMODULE_ATTR_PRINTF(idx, cnt) __attribute__((format(printf, idx, cnt)))
#else
#define VALKEYMODULE_ATTR_PRINTF(idx, cnt)
#endif
#endif

#ifndef VALKEYMODULE_ATTR_COMMON

Review comment (suggestion):
```suggestion
#define ValkeyModuleScriptingEngineMethods ValkeyModuleScriptingEngineMethodsV1
```

Code after:
     * callback will be called with the script code, compiles it, and returns a
     * list of `ValkeyModuleScriptingEngineCompiledFunc` objects. */
    union {
        ValkeyModuleScriptingEngineCompileCodeFuncV1 compile_code_v1;
        ValkeyModuleScriptingEngineCompileCodeFunc compile_code;
    };
    /* Function callback to free the memory of a registered engine function. */
    ValkeyModuleScriptingEngineFreeFunctionFunc free_function;

    /* The callback function called when `FCALL` command is called on a function
     * registered in this engine. */
    ValkeyModuleScriptingEngineCallFunctionFunc call_function;

    /* Function callback to return memory overhead for a given function. */
    ValkeyModuleScriptingEngineGetFunctionMemoryOverheadFunc get_function_memory_overhead;

    /* The callback function used to reset the runtime environment used
     * by the scripting engine for EVAL scripts. */
    ValkeyModuleScriptingEngineResetEvalEnvFunc reset_eval_env;

    /* Function callback to get the used memory by the engine. */
    ValkeyModuleScriptingEngineGetMemoryInfoFunc get_memory_info;

} ValkeyModuleScriptingEngineMethodsV1;

#define ValkeyModuleScriptingEngineMethods ValkeyModuleScriptingEngineMethodsV1

/* ------------------------- End of common defines ------------------------ */

/* ----------- The rest of the defines are only for modules ----------------- */
#if !defined VALKEYMODULE_CORE || defined VALKEYMODULE_CORE_MODULE
/* Things defined for modules and core-modules. */

/* Macro definitions specific to individual compilers */
#ifndef VALKEYMODULE_ATTR_UNUSED
#ifdef __GNUC__
#define VALKEYMODULE_ATTR_UNUSED __attribute__((unused))
#else
#define VALKEYMODULE_ATTR_UNUSED
#endif
#endif

#ifndef VALKEYMODULE_ATTR_PRINTF
#ifdef __GNUC__
#define VALKEYMODULE_ATTR_PRINTF(idx, cnt) __attribute__((format(printf, idx, cnt)))
#else
#define VALKEYMODULE_ATTR_PRINTF(idx, cnt)
#endif
#endif

#ifndef VALKEYMODULE_ATTR_COMMON