Files
ground-rewrite/src/New/String.c
2026-06-20 19:45:52 +10:00

22 lines
450 B
C

#include "../../include/ground.h"
GroundString _GroundNewString(const char* in) {
GroundSize len = strlen(in);
GroundString string = {
.len = len,
.cstr = malloc(sizeof(len) + 1)
};
if (string.cstr == NULL) {
Ground.Log.Error("malloc failed in Ground.New.String()");
Ground.Flags.error = true;
string.len = 0;
return string;
}
strcpy(string.cstr, in);
return string;
}