Use reference counting for identifiers
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "../../include/ground.h"
|
||||
#include <string.h>
|
||||
|
||||
void _GroundFunctionAppendArg(GroundFunction* function, const char* argName) {
|
||||
void _GroundFunctionAppendArg(GroundFunction* function, GroundIdentifier* argName) {
|
||||
if (function->isNativeFunction) {
|
||||
Ground.Log.Error("Cannot add arg to native function in Ground.Function.appendArg()");
|
||||
Ground.Flags.error = true;
|
||||
@@ -19,14 +18,6 @@ void _GroundFunctionAppendArg(GroundFunction* function, const char* argName) {
|
||||
function->args.capacity *= 2;
|
||||
}
|
||||
|
||||
size_t len = strlen(argName);
|
||||
function->args.at[function->args.count].as.id = malloc(sizeof(char) * (len + 1));
|
||||
if (function->args.at[function->args.count].as.id == NULL) {
|
||||
Ground.Log.Error("malloc failed in Ground.Function.appendArg()");
|
||||
Ground.Flags.error = true;
|
||||
return;
|
||||
}
|
||||
|
||||
strcpy(function->args.at[function->args.count].as.id, argName);
|
||||
function->args.at[function->args.count].as.id = Ground.Copy.Identifier(argName);
|
||||
function->args.count++;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user