X-Git-Url: https://git.kernel.dk/?a=blobdiff_plain;f=json.c;h=e2819a65ba6a3236f7a3dba8a506eca07ddfb0fc;hb=2e86a90c49ec09c977405cdc6c183c796cef77c3;hp=2160d296445fae5cf5aebbd8fbdb91155bf71cfc;hpb=af13d1e88158d3e37940648be139d7a46fe00431;p=fio.git diff --git a/json.c b/json.c index 2160d296..e2819a65 100644 --- a/json.c +++ b/json.c @@ -1,6 +1,5 @@ #include #include -#include #include #include #include "json.h" @@ -231,7 +230,6 @@ int json_object_add_value_type(struct json_object *obj, const char *name, int ty return 0; } -static void json_print_array(struct json_array *array, struct buf_output *); int json_array_add_value_type(struct json_array *array, int type, ...) { struct json_value *value; @@ -297,8 +295,8 @@ static void json_print_level(int level, struct buf_output *out) } static void json_print_pair(struct json_pair *pair, struct buf_output *); -static void json_print_array(struct json_array *array, struct buf_output *); static void json_print_value(struct json_value *value, struct buf_output *); + void json_print_object(struct json_object *obj, struct buf_output *out) { int i; @@ -340,13 +338,9 @@ static void json_print_array(struct json_array *array, struct buf_output *out) static void json_print_value(struct json_value *value, struct buf_output *out) { switch (value->type) { - case JSON_TYPE_STRING: { - const char delimiter = '"'; - buf_output_add(out, &delimiter, sizeof(delimiter)); - buf_output_add(out, value->string, strlen(value->string)); - buf_output_add(out, &delimiter, sizeof(delimiter)); - break; - } + case JSON_TYPE_STRING: + log_buf(out, "\"%s\"", value->string); + break; case JSON_TYPE_INTEGER: log_buf(out, "%lld", value->integer_number); break;