Give every exported function a declaration, and check that it stays that way
Closes internal-consistency items 7 through 15. Nineteen non-static functions were in the ABI with no declaration anywhere, so no consumer could call them and any consumer could collide with them. The four gamepad_handle_* functions are the ones that mattered: controller.h declared akgl_controller_handle_button_down and three siblings that did not exist, so anything compiled against the header alone failed to link. The definitions carry the declared names now, which also closes Defects -> Known and still open item 10, and their documentation moved to the header. The rest are either declared under a "part of the internal API" block -- akgl_game_save_actors and akgl_game_load_versioncmp, which tests/game.c had to declare for itself, plus six tilemap loader helpers the untested-loader work wants to reach -- or static, which is what the four save iterators and load_objectnamemap should always have been. akgl_path_relative_from is deleted: declared nowhere, called from nowhere, never wrote its output, and leaked a pooled string on every call, so it closes Known and still open item 4 and item 40 by ceasing to exist. scripts/check_api_surface.sh keeps it closed. It reads the built library's dynamic symbol table and every public header with comments stripped, and fails on an exported akgl_* symbol that is declared nowhere. Stripping comments is the whole point -- four of these were mentioned in controller.h prose, which is how they went unnoticed. The pool-size ceilings are defined once, in heap.h, so the #ifndef override hook fires for the first time; actor.h, sprite.h and character.h were defining the same four unconditionally from headers heap.h includes above its own guard. tests/header_pool_override.c fails the compile if that regresses. Also here: (void) rather than () on the twelve no-argument entry points, AKERR_NOIGNORE only on declarations, static helpers with the akgl_ prefix dropped, and the six parameter-name mismatches. akgl_get_json_with_default had its two contexts swapped rather than merely misspelled -- the incoming one was `err` and its own was `e`, which is the name reserved for an incoming one. 24/24 pass, reindent --check clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,7 +25,7 @@ SDL_PropertiesID AKGL_REGISTRY_MUSIC = 0;
|
||||
SDL_PropertiesID AKGL_REGISTRY_FONT = 0;
|
||||
SDL_PropertiesID AKGL_REGISTRY_PROPERTIES = 0;
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init()
|
||||
akerr_ErrorContext *akgl_registry_init(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
ATTEMPT {
|
||||
@@ -42,7 +42,7 @@ akerr_ErrorContext *akgl_registry_init()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_actor()
|
||||
akerr_ErrorContext *akgl_registry_init_actor(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
if ( AKGL_REGISTRY_ACTOR != 0 ) {
|
||||
@@ -53,7 +53,7 @@ akerr_ErrorContext *akgl_registry_init_actor()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_font()
|
||||
akerr_ErrorContext *akgl_registry_init_font(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_FONT = SDL_CreateProperties();
|
||||
@@ -61,7 +61,7 @@ akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_init_font()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_music()
|
||||
akerr_ErrorContext *akgl_registry_init_music(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_MUSIC = SDL_CreateProperties();
|
||||
@@ -69,7 +69,7 @@ akerr_ErrorContext *akgl_registry_init_music()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_properties()
|
||||
akerr_ErrorContext *akgl_registry_init_properties(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_PROPERTIES = SDL_CreateProperties();
|
||||
@@ -77,7 +77,7 @@ akerr_ErrorContext *akgl_registry_init_properties()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_actor_state_strings()
|
||||
akerr_ErrorContext *akgl_registry_init_actor_state_strings(void)
|
||||
{
|
||||
int i = 0;
|
||||
int flag = 0;
|
||||
@@ -94,7 +94,7 @@ akerr_ErrorContext *akgl_registry_init_actor_state_strings()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_sprite()
|
||||
akerr_ErrorContext *akgl_registry_init_sprite(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_SPRITE = SDL_CreateProperties();
|
||||
@@ -102,7 +102,7 @@ akerr_ErrorContext *akgl_registry_init_sprite()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_spritesheet()
|
||||
akerr_ErrorContext *akgl_registry_init_spritesheet(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_SPRITESHEET = SDL_CreateProperties();
|
||||
@@ -110,7 +110,7 @@ akerr_ErrorContext *akgl_registry_init_spritesheet()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_registry_init_character()
|
||||
akerr_ErrorContext *akgl_registry_init_character(void)
|
||||
{
|
||||
PREPARE_ERROR(errctx);
|
||||
AKGL_REGISTRY_CHARACTER = SDL_CreateProperties();
|
||||
@@ -118,7 +118,7 @@ akerr_ErrorContext *akgl_registry_init_character()
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_load_properties(char *fname)
|
||||
akerr_ErrorContext *akgl_registry_load_properties(char *fname)
|
||||
{
|
||||
json_t *json = NULL;
|
||||
json_t *props = NULL;
|
||||
@@ -175,16 +175,16 @@ akerr_ErrorContext AKERR_NOIGNORE *akgl_registry_load_properties(char *fname)
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_set_property(char *name, char *src)
|
||||
akerr_ErrorContext *akgl_set_property(char *name, char *value)
|
||||
{
|
||||
PREPARE_ERROR(e);
|
||||
FAIL_ZERO_RETURN(e, name, AKERR_NULLPOINTER, "NULL char *");
|
||||
FAIL_ZERO_RETURN(e, src, AKERR_NULLPOINTER, "NULL char *");
|
||||
SDL_SetStringProperty(AKGL_REGISTRY_PROPERTIES, name, src);
|
||||
FAIL_ZERO_RETURN(e, value, AKERR_NULLPOINTER, "NULL char *");
|
||||
SDL_SetStringProperty(AKGL_REGISTRY_PROPERTIES, name, value);
|
||||
SUCCEED_RETURN(e);
|
||||
}
|
||||
|
||||
akerr_ErrorContext AKERR_NOIGNORE *akgl_get_property(char *name, akgl_String **dest, char *def)
|
||||
akerr_ErrorContext *akgl_get_property(char *name, akgl_String **dest, char *def)
|
||||
{
|
||||
const char *value = NULL;
|
||||
size_t valuelen = 0;
|
||||
|
||||
Reference in New Issue
Block a user