2025-08-03 10:07:35 -04:00
|
|
|
#include <sdlerror.h>
|
2025-08-03 10:41:09 -04:00
|
|
|
#include <sdl3game/staticstring.h>
|
2025-08-03 10:07:35 -04:00
|
|
|
|
|
|
|
|
ErrorContext *string_initialize(string *obj, char *init)
|
|
|
|
|
{
|
|
|
|
|
PREPARE_ERROR(errctx);
|
|
|
|
|
FAIL_ZERO_RETURN(errctx, obj, ERR_NULLPOINTER, "Attempted to initialize NULL string reference");
|
|
|
|
|
if ( init != NULL ) {
|
|
|
|
|
strncpy((char *)&obj->data, init, MAX_STRING_LENGTH);
|
|
|
|
|
} else {
|
|
|
|
|
memset(&obj->data, 0x00, sizeof(string));
|
|
|
|
|
}
|
|
|
|
|
obj->refcount = 1;
|
|
|
|
|
SUCCEED_RETURN(errctx);
|
|
|
|
|
}
|