Exported libsdl3game from the sdl3-gametest demo project
This commit is contained in:
15
src/staticstring.c
Normal file
15
src/staticstring.c
Normal file
@@ -0,0 +1,15 @@
|
||||
#include <sdlerror.h>
|
||||
#include "staticstring.h"
|
||||
|
||||
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);
|
||||
}
|
||||
Reference in New Issue
Block a user