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>
This commit is contained in:
@@ -177,11 +177,11 @@ akerr_ErrorContext *akgl_registry_load_properties(char *fname)
|
||||
|
||||
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, value, AKERR_NULLPOINTER, "NULL char *");
|
||||
PREPARE_ERROR(errctx);
|
||||
FAIL_ZERO_RETURN(errctx, name, AKERR_NULLPOINTER, "NULL char *");
|
||||
FAIL_ZERO_RETURN(errctx, value, AKERR_NULLPOINTER, "NULL char *");
|
||||
SDL_SetStringProperty(AKGL_REGISTRY_PROPERTIES, name, value);
|
||||
SUCCEED_RETURN(e);
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
akerr_ErrorContext *akgl_get_property(char *name, akgl_String **dest, char *def)
|
||||
@@ -189,12 +189,12 @@ akerr_ErrorContext *akgl_get_property(char *name, akgl_String **dest, char *def)
|
||||
const char *value = NULL;
|
||||
size_t valuelen = 0;
|
||||
|
||||
PREPARE_ERROR(e);
|
||||
FAIL_ZERO_RETURN(e, name, AKERR_NULLPOINTER, "NULL char *");
|
||||
FAIL_ZERO_RETURN(e, dest, AKERR_NULLPOINTER, "NULL akgl_String *");
|
||||
PREPARE_ERROR(errctx);
|
||||
FAIL_ZERO_RETURN(errctx, name, AKERR_NULLPOINTER, "NULL char *");
|
||||
FAIL_ZERO_RETURN(errctx, dest, AKERR_NULLPOINTER, "NULL akgl_String *");
|
||||
ATTEMPT {
|
||||
if ( *dest == NULL ) {
|
||||
CATCH(e, akgl_heap_next_string(dest));
|
||||
CATCH(errctx, akgl_heap_next_string(dest));
|
||||
}
|
||||
// Copy the value's own length, not the destination's capacity. What
|
||||
// SDL hands back is its strdup of the value -- four bytes for "0.0" --
|
||||
@@ -207,23 +207,23 @@ akerr_ErrorContext *akgl_get_property(char *name, akgl_String **dest, char *def)
|
||||
// which is what the header has always promised. It used to arrive from
|
||||
// inside aksl_memcpy; now it is raised here, before anything is measured.
|
||||
FAIL_ZERO_BREAK(
|
||||
e,
|
||||
errctx,
|
||||
value,
|
||||
AKERR_NULLPOINTER,
|
||||
"Property %s is not set and no default was given",
|
||||
name);
|
||||
valuelen = strlen(value);
|
||||
FAIL_NONZERO_BREAK(
|
||||
e,
|
||||
errctx,
|
||||
(valuelen >= AKGL_MAX_STRING_LENGTH),
|
||||
AKERR_OUTOFBOUNDS,
|
||||
"Property %s is %zu bytes, which does not fit an akgl_String (%d)",
|
||||
name,
|
||||
valuelen,
|
||||
AKGL_MAX_STRING_LENGTH);
|
||||
CATCH(e, aksl_memcpy((*dest)->data, (void *)value, (valuelen + 1)));
|
||||
CATCH(errctx, aksl_memcpy((*dest)->data, (void *)value, (valuelen + 1)));
|
||||
} CLEANUP {
|
||||
} PROCESS(e) {
|
||||
} FINISH(e, true);
|
||||
SUCCEED_RETURN(e);
|
||||
} PROCESS(errctx) {
|
||||
} FINISH(errctx, true);
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user