22 lines
450 B
C
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;
|
|
}
|