[libvirt] [PATCH 5/9] util: json: Split out code to create json value objects
Peter Krempa
pkrempa at redhat.com
Wed Oct 15 07:32:45 UTC 2014
On 10/14/14 12:46, John Ferlan wrote:
>
>
> On 10/14/2014 03:29 AM, Peter Krempa wrote:
>> Our qemu monitor code has a converter from key-value pairs to a json
>> value object. I want to re-use the code later and having it part of the
>> monitor command generator is inflexible. Split it out into a separate
>> helper.
>> ---
>> src/libvirt_private.syms | 2 +
>> src/qemu/qemu_monitor_json.c | 161 +--------------------------------
>> src/util/virjson.c | 211 +++++++++++++++++++++++++++++++++++++++++++
>> src/util/virjson.h | 5 +
>> 4 files changed, 220 insertions(+), 159 deletions(-)
>>
...
>>
>> typedef enum {
>> VIR_JSON_TYPE_OBJECT,
>> @@ -79,6 +81,9 @@ struct _virJSONValue {
>>
>> void virJSONValueFree(virJSONValuePtr value);
>>
>> +int virJSONValueObjectCreate(virJSONValuePtr *obj, ...);
>> +int virJSONValueObjectCreateVArgs(virJSONValuePtr *obj, va_list args);
>
> Add an ATTRIBUTE_NONNULL(1) for this definition, since you deref in
> function.
>
>
> ACK with adjustments
I've also added an ATTRIBUTE_SENTINEL to the first function.
>
> John
>
>> +
>> virJSONValuePtr virJSONValueNewString(const char *data);
>> virJSONValuePtr virJSONValueNewStringLen(const char *data, size_t length);
>> virJSONValuePtr virJSONValueNewNumberInt(int data);
>>
Peter
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20141015/fb11d48f/attachment-0001.sig>
More information about the libvir-list
mailing list