summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/zbxjson.h2
-rw-r--r--src/libs/zbxjson/json.c13
2 files changed, 15 insertions, 0 deletions
diff --git a/include/zbxjson.h b/include/zbxjson.h
index 17b45d6d..6837120c 100644
--- a/include/zbxjson.h
+++ b/include/zbxjson.h
@@ -27,6 +27,7 @@
#define ZBX_PROTO_TAG_DELAY "delay"
#define ZBX_PROTO_TAG_DISCOVERY_DATA "discovery data"
#define ZBX_PROTO_TAG_DRULE "drule"
+#define ZBX_PROTO_VALUE_HISTORY_DATA "history data"
#define ZBX_PROTO_TAG_HOST "host"
#define ZBX_PROTO_TAG_INFO "info"
#define ZBX_PROTO_TAG_IP "ip"
@@ -83,6 +84,7 @@ struct zbx_json_parse {
char *zbx_json_strerror(void);
void zbx_json_init(struct zbx_json *j, size_t allocate);
+void zbx_json_clean(struct zbx_json *j);
void zbx_json_free(struct zbx_json *j);
void zbx_json_addobject(struct zbx_json *j, const char *name);
void zbx_json_addarray(struct zbx_json *j, const char *name);
diff --git a/src/libs/zbxjson/json.c b/src/libs/zbxjson/json.c
index e14f9856..809cc396 100644
--- a/src/libs/zbxjson/json.c
+++ b/src/libs/zbxjson/json.c
@@ -79,6 +79,19 @@ void zbx_json_init(struct zbx_json *j, size_t allocate)
zbx_json_addobject(j, NULL);
}
+void zbx_json_clean(struct zbx_json *j)
+{
+ assert(j);
+
+ j->buffer_offset = 0;
+ j->buffer_size = 0;
+ j->status = ZBX_JSON_EMPTY;
+ j->level = 0;
+ *j->buffer = '\0';
+
+ zbx_json_addobject(j, NULL);
+}
+
void zbx_json_free(struct zbx_json *j)
{
assert(j);