Use reference counting for identifiers
This commit is contained in:
@@ -1,26 +1,9 @@
|
||||
#include "../../../include/ground.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
GroundArg _GroundNewArgValueRef(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.ValueRef()");
|
||||
Ground.Flags.error = true;
|
||||
return (GroundArg) {
|
||||
.type = GroundArg_DirectRef,
|
||||
.as.ref = ""
|
||||
};
|
||||
}
|
||||
|
||||
strcpy(copy, ref);
|
||||
|
||||
GroundArg _GroundNewArgValueRef(GroundIdentifier* ref) {
|
||||
return (GroundArg) {
|
||||
.type = GroundArg_ValueRef,
|
||||
.as.ref = copy
|
||||
.as.ref = Ground.Copy.Identifier(ref)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user