X-Git-Url: https://git.kernel.dk/?p=fio.git;a=blobdiff_plain;f=json.h;h=962c11c24e30673b1230ebbec91139b528e17bf2;hp=4d05e82302522b67c387b0c30470bcb5eda4eea3;hb=2cac8fcb5ecaf5de549c36ee1cc2db75f00f8ff4;hpb=cc372b17f2827e89da79241f1bbaca1e7c650611 diff --git a/json.h b/json.h index 4d05e823..962c11c2 100644 --- a/json.h +++ b/json.h @@ -14,7 +14,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 +52,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 +73,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)) +#define json_array_last_value_object(obj) \ + (obj->values[obj->value_cnt - 1]->object) + void json_print_object(struct json_object *obj); #endif