diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-07 12:43:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-07 12:43:34 +0000 |
commit | 8e1dcd44fcad7826e5f8fa6c5caa6c23989518d9 (patch) | |
tree | 8a5e1e9d02b2562d57d57ef88e26d4778ebeeab3 /util/json.c | |
parent | Releasing debian version 2.4+really2.3-2. (diff) | |
download | nvme-cli-8e1dcd44fcad7826e5f8fa6c5caa6c23989518d9.tar.xz nvme-cli-8e1dcd44fcad7826e5f8fa6c5caa6c23989518d9.zip |
Merging upstream version 2.4+really2.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'util/json.c')
-rw-r--r-- | util/json.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/util/json.c b/util/json.c index 84d43e5..2de5848 100644 --- a/util/json.c +++ b/util/json.c @@ -35,10 +35,24 @@ struct json_object *util_json_object_new_uint64(uint64_t i) } +static int util_json_object_string_to_number(struct json_object *jso, + struct printbuf *pb, int level, + int flags) +{ + ssize_t len = json_object_get_string_len(jso); + + printbuf_memappend(pb, json_object_get_string(jso), len); + + return 0; +} + struct json_object *util_json_object_new_uint128(nvme_uint128_t val) { struct json_object *obj; + obj = json_object_new_string(uint128_t_to_string(val)); + json_object_set_serializer(obj, util_json_object_string_to_number, NULL, NULL); + return obj; } |