26 lines
489 B
C
26 lines
489 B
C
|
|
#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.Flags.error = true;
|
||
|
|
return (GroundArg) {
|
||
|
|
.type = GroundArg_DirectRef,
|
||
|
|
.as.ref = ""
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
strcpy(copy, ref);
|
||
|
|
|
||
|
|
return (GroundArg) {
|
||
|
|
.type = GroundArg_ValueRef,
|
||
|
|
.as.ref = copy
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|