Name every local error context errctx
Closes internal-consistency item 18. The convention was settled -- AGENTS.md records errctx winning 92 sites to 45 -- but the other 45 were still there, and four files favoured `e` throughout while six favoured errctx, sometimes within one file. Its own commit because it is a rename and nothing else. All 333 changed lines are a single identifier substitution: applying \be\b -> errctx to each removed line reproduces the added line exactly, and the counts match at 333 either way. `e` keeps its meaning where the convention actually wants it -- an incoming error context being inspected, as in akgl_get_json_with_default(e, ...) -- which is why that function was left alone. 25/25 pass, reindent --check clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Co-Authored-By: Andrew Kesterson <andrew@aklabs.net>
This commit is contained in:
@@ -186,9 +186,9 @@ akerr_ErrorContext *akgl_controller_list_keyboards(void)
|
||||
{
|
||||
int count;
|
||||
SDL_KeyboardID *keyboards = SDL_GetKeyboards(&count);
|
||||
PREPARE_ERROR(e);
|
||||
PREPARE_ERROR(errctx);
|
||||
|
||||
FAIL_ZERO_RETURN(e, keyboards, AKERR_NULLPOINTER, "%s", SDL_GetError());
|
||||
FAIL_ZERO_RETURN(errctx, keyboards, AKERR_NULLPOINTER, "%s", SDL_GetError());
|
||||
|
||||
// The array is SDL's to allocate and ours to free -- that is the contract on
|
||||
// every SDL_Get*s() enumeration. Released in CLEANUP so the loop can fail
|
||||
@@ -201,9 +201,9 @@ akerr_ErrorContext *akgl_controller_list_keyboards(void)
|
||||
} CLEANUP {
|
||||
SDL_free(keyboards);
|
||||
keyboards = NULL;
|
||||
} PROCESS(e) {
|
||||
} FINISH(e, true);
|
||||
SUCCEED_RETURN(e);
|
||||
} PROCESS(errctx) {
|
||||
} FINISH(errctx, true);
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_controller_open_gamepads(void)
|
||||
@@ -213,14 +213,14 @@ akerr_ErrorContext *akgl_controller_open_gamepads(void)
|
||||
SDL_JoystickID *gamepads = NULL;
|
||||
SDL_Gamepad *gamepad = NULL;
|
||||
|
||||
PREPARE_ERROR(e);
|
||||
PREPARE_ERROR(errctx);
|
||||
if ( SDL_HasGamepad() ) {
|
||||
gamepads = SDL_GetGamepads(&count);
|
||||
if ( count > 0 ) {
|
||||
FAIL_ZERO_RETURN(e, gamepads, AKERR_NULLPOINTER, "%s", SDL_GetError());
|
||||
FAIL_ZERO_RETURN(errctx, gamepads, AKERR_NULLPOINTER, "%s", SDL_GetError());
|
||||
for ( i = 0; i < count ; i++ ) {
|
||||
gamepad = SDL_OpenGamepad(gamepads[i]);
|
||||
FAIL_ZERO_RETURN(e, gamepad, AKERR_NULLPOINTER, "%s", SDL_GetError());
|
||||
FAIL_ZERO_RETURN(errctx, gamepad, AKERR_NULLPOINTER, "%s", SDL_GetError());
|
||||
SDL_Log("Gamepad %d is %s", i, SDL_GetGamepadNameForID(gamepads[i]));
|
||||
}
|
||||
SDL_free(gamepads);
|
||||
@@ -230,7 +230,7 @@ akerr_ErrorContext *akgl_controller_open_gamepads(void)
|
||||
} else {
|
||||
SDL_Log("No gamepads connected");
|
||||
}
|
||||
SUCCEED_RETURN(e);
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_controller_handle_event(void *appstate, SDL_Event *event)
|
||||
|
||||
Reference in New Issue
Block a user