2026-01-05 08:58:06 -05:00
|
|
|
#include <akerror.h>
|
2025-08-03 10:41:09 -04:00
|
|
|
#include <sdl3game/staticstring.h>
|
2025-08-03 10:07:35 -04:00
|
|
|
|
2026-05-06 23:18:42 -04:00
|
|
|
akerr_ErrorContext *akgl_string_initialize(akgl_String *obj, char *init)
|
2025-08-03 10:07:35 -04:00
|
|
|
{
|
|
|
|
|
PREPARE_ERROR(errctx);
|
2026-05-03 23:57:55 -04:00
|
|
|
FAIL_ZERO_RETURN(errctx, obj, AKERR_NULLPOINTER, "Attempted to initialize NULL string reference");
|
2025-08-03 10:07:35 -04:00
|
|
|
if ( init != NULL ) {
|
2026-05-06 23:18:42 -04:00
|
|
|
strncpy((char *)&obj->data, init, AKGL_MAX_STRING_LENGTH);
|
2025-08-03 10:07:35 -04:00
|
|
|
} else {
|
2026-05-06 23:18:42 -04:00
|
|
|
memset(&obj->data, 0x00, sizeof(akgl_String));
|
2025-08-03 10:07:35 -04:00
|
|
|
}
|
|
|
|
|
obj->refcount = 1;
|
|
|
|
|
SUCCEED_RETURN(errctx);
|
|
|
|
|
}
|