
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