[T106][ZXW-22]7520V3SCV2.01.01.02P42U09_VEC_V0.8_AP_VEC origin source commit
Change-Id: Ic6e05d89ecd62fc34f82b23dcf306c93764aec4b
diff --git a/ap/app/goahead/server/value.c b/ap/app/goahead/server/value.c
new file mode 100755
index 0000000..66a2fcf
--- /dev/null
+++ b/ap/app/goahead/server/value.c
@@ -0,0 +1,41 @@
+#include "uemf.h"
+
+value_t valueString(char_t* value, int flags)
+{
+ value_t v;
+
+ memset(&v, 0x0, sizeof(v));
+ v.valid = 1;
+ v.type = string;
+ if (flags & VALUE_ALLOCATE) {
+ v.allocated = 1;
+ v.value.string = gstrdup(B_L, value);
+ } else {
+ v.allocated = 0;
+ v.value.string = value;
+ }
+ return v;
+}
+
+value_t valueInteger(long value)
+{
+ value_t v;
+
+ memset(&v, 0x0, sizeof(v));
+ v.valid = 1;
+ v.type = integer;
+ v.value.integer = value;
+ return v;
+}
+
+void valueFree(value_t* v)
+{
+ if (v->valid && v->allocated && v->type == string &&
+ v->value.string != NULL) {
+ bfree(B_L, v->value.string);
+ }
+ v->type = undefined;
+ v->valid = 0;
+ v->allocated = 0;
+}
+