Files
ground-rewrite/src/New/String.c

22 lines
450 B
C
Raw Normal View History

2026-06-13 19:45:36 +10:00
#include "../../include/ground.h"
GroundString _GroundNewString(const char* in) {
2026-06-20 19:45:52 +10:00
GroundSize len = strlen(in);
2026-06-13 19:45:36 +10:00
GroundString string = {
.len = len,
.cstr = malloc(sizeof(len) + 1)
};
if (string.cstr == NULL) {
2026-06-15 20:27:50 +10:00
Ground.Log.Error("malloc failed in Ground.New.String()");
2026-06-13 19:45:36 +10:00
Ground.Flags.error = true;
string.len = 0;
return string;
}
strcpy(string.cstr, in);
return string;
}