blob: 66a2fcf42b5afdf9d17e3afcf71c4a3ba53fd077 [file] [log] [blame]
lh9ed821d2023-04-07 01:36:19 -07001#include "uemf.h"
2
3value_t valueString(char_t* value, int flags)
4{
5 value_t v;
6
7 memset(&v, 0x0, sizeof(v));
8 v.valid = 1;
9 v.type = string;
10 if (flags & VALUE_ALLOCATE) {
11 v.allocated = 1;
12 v.value.string = gstrdup(B_L, value);
13 } else {
14 v.allocated = 0;
15 v.value.string = value;
16 }
17 return v;
18}
19
20value_t valueInteger(long value)
21{
22 value_t v;
23
24 memset(&v, 0x0, sizeof(v));
25 v.valid = 1;
26 v.type = integer;
27 v.value.integer = value;
28 return v;
29}
30
31void valueFree(value_t* v)
32{
33 if (v->valid && v->allocated && v->type == string &&
34 v->value.string != NULL) {
35 bfree(B_L, v->value.string);
36 }
37 v->type = undefined;
38 v->valid = 0;
39 v->allocated = 0;
40}
41