optimise
This commit is contained in:
@@ -2,9 +2,9 @@
|
||||
|
||||
GroundFunction _GroundNewFunction(GroundState* state) {
|
||||
GroundFunction function = {
|
||||
.args.at = malloc(sizeof(char*) * 16),
|
||||
.args.at = malloc(sizeof(GroundFunctionArg) * 16),
|
||||
.args.count = 0,
|
||||
.args.capacity = 0,
|
||||
.args.capacity = 16,
|
||||
|
||||
.closure = malloc(sizeof(GroundState)),
|
||||
.isNativeFunction = false,
|
||||
|
||||
@@ -21,7 +21,14 @@ GroundObject _GroundNewObject(GroundStruct* in) {
|
||||
}
|
||||
|
||||
strncpy(item->name, s->name, 2047);
|
||||
|
||||
|
||||
item->value = malloc(sizeof(GroundValue));
|
||||
if (item->value == NULL) {
|
||||
Ground.Log.Error("malloc failed in Ground.New.Object()");
|
||||
Ground.Flags.error = true;
|
||||
return object;
|
||||
}
|
||||
|
||||
*item->value = Ground.Copy.Value(s->value);
|
||||
|
||||
if (Ground.Flags.error) {
|
||||
|
||||
@@ -6,7 +6,7 @@ GroundString _GroundNewString(const char* in) {
|
||||
|
||||
GroundString string = {
|
||||
.len = len,
|
||||
.cstr = malloc(sizeof(len) + 1)
|
||||
.cstr = malloc(len + 1)
|
||||
};
|
||||
|
||||
if (string.cstr == NULL) {
|
||||
|
||||
Reference in New Issue
Block a user