Use reference counting for identifiers

This commit is contained in:
2026-06-17 10:11:15 +10:00
parent 6d35acbe60
commit b4e481ed9c
16 changed files with 112 additions and 156 deletions

View File

@@ -1,25 +1,8 @@
#include "../../../include/ground.h"
#include <string.h>
#include <stdlib.h>
GroundArg _GroundNewArgFunctionRef(const char* ref) {
size_t len = strlen(ref);
char* copy = malloc(len + 1);
if (copy == NULL) {
Ground.Log.Error("malloc failed in Ground.New.Arg.FunctionRef()");
Ground.Flags.error = true;
return (GroundArg) {
.type = GroundArg_DirectRef,
.as.ref = ""
};
}
strcpy(copy, ref);
GroundArg _GroundNewArgFunctionRef(GroundIdentifier* ref) {
return (GroundArg) {
.type = GroundArg_FunctionRef,
.as.ref = copy
.as.ref = Ground.Copy.Identifier(ref)
};
}