Merge branch 'dev' of https://github.com/smartxworks/fio
[fio.git] / json.h
diff --git a/json.h b/json.h
index 4d05e82302522b67c387b0c30470bcb5eda4eea3..bcc712cd4d414b91aeb923ae69c3b9bcd8a4c0b9 100644 (file)
--- a/json.h
+++ b/json.h
@@ -1,8 +1,7 @@
 #ifndef __JSON__H
 #define __JSON__H
-struct json_object;
-struct json_array;
-struct json_pair;
+
+#include "lib/output_buffer.h"
 
 #define JSON_TYPE_STRING 0
 #define JSON_TYPE_INTEGER 1
@@ -14,7 +13,7 @@ struct json_pair;
 struct json_value {
        int type;
        union {
-               long integer_number;
+               long long integer_number;
                double float_number;
                char *string;
                struct json_object *object;
@@ -52,7 +51,7 @@ void json_free_object(struct json_object *obj);
 
 int json_object_add_value_type(struct json_object *obj, const char *name, int type, ...);
 #define json_object_add_value_int(obj, name, val) \
-       json_object_add_value_type((obj), name, JSON_TYPE_INTEGER, (val))
+       json_object_add_value_type((obj), name, JSON_TYPE_INTEGER, (long long) (val))
 #define json_object_add_value_float(obj, name, val) \
        json_object_add_value_type((obj), name, JSON_TYPE_FLOAT, (val))
 #define json_object_add_value_string(obj, name, val) \
@@ -73,5 +72,8 @@ int json_array_add_value_type(struct json_array *array, int type, ...);
 #define json_array_add_value_array(obj, val) \
        json_array_add_value_type((obj), JSON_TYPE_ARRAY, (val))
 
-void json_print_object(struct json_object *obj);
+#define json_array_last_value_object(obj) \
+       (obj->values[obj->value_cnt - 1]->object)
+
+void json_print_object(struct json_object *obj, struct buf_output *out);
 #endif