From aba10d7dacf470867b860d2a079d56457f9b4ffd Mon Sep 17 00:00:00 2001 From: anth64 Date: Thu, 29 Jan 2026 23:11:42 +0100 Subject: [PATCH] fix: sync module types and replace WIP constants * Types: Corrected stk.c to use stk_init_mod_func and stk_shutdown_mod_func instead of generic types. * Errors: Replaced -3 placeholder with STK_MOD_INIT_FAILURE. * Cleanup: Moved typedefs in module.c for consistency. --- src/module.c | 8 ++++---- src/stk.c | 7 ++++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/module.c b/src/module.c index 49922f9..7c6bab3 100644 --- a/src/module.c +++ b/src/module.c @@ -11,13 +11,13 @@ #define STK_PATH_SEP '/' #endif +typedef int (*stk_init_mod_func)(void); +typedef void (*stk_shutdown_mod_func)(void); + void *platform_load_library(const char *path); void platform_unload_library(void *handle); void *platform_get_symbol(void *handle, const char *symbol); -typedef int (*stk_init_mod_func)(void); -typedef void (*stk_shutdown_mod_func)(void); - char (*stk_module_ids)[STK_MOD_ID_BUFFER] = NULL; void **stk_handles = NULL; stk_init_mod_func *stk_inits = NULL; @@ -108,7 +108,7 @@ int stk_module_load(const char *path, int index) if (init_func() != STK_MOD_INIT_SUCCESS) { platform_unload_library(handle); - return -3; + return STK_MOD_INIT_FAILURE; } strncpy(stk_module_ids[index], module_id, STK_MOD_ID_BUFFER - 1); diff --git a/src/stk.c b/src/stk.c index 2d678a7..d4947f7 100644 --- a/src/stk.c +++ b/src/stk.c @@ -5,11 +5,12 @@ #include #include -typedef void (*stk_module_func)(void); +typedef int (*stk_init_mod_func)(void); +typedef void (*stk_shutdown_mod_func)(void); extern void **stk_handles; -extern stk_module_func *stk_inits; -extern stk_module_func *stk_shutdowns; +extern stk_init_mod_func *stk_inits; +extern stk_shutdown_mod_func *stk_shutdowns; extern char (*stk_module_ids)[STK_MOD_ID_BUFFER]; extern size_t module_count;