They were not used anywhere so far so nobody noticed they are broken. --- src/util/json.c | 11 ++++++----- src/util/json.h | 4 ++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/util/json.c b/src/util/json.c index 0daeae9..df4771d 100644 --- a/src/util/json.c +++ b/src/util/json.c @@ -491,12 +491,13 @@ int virJSONValueGetNumberDouble(virJSONValuePtr number, double *value) } -int virJSONValueGetBoolean(virJSONValuePtr val) +int virJSONValueGetBoolean(virJSONValuePtr val, bool *value) { - if (val->type != VIR_JSON_TYPE_NUMBER) + if (val->type != VIR_JSON_TYPE_BOOLEAN) return -1; - return val->data.boolean; + *value = val->data.boolean; + return 0; } @@ -593,7 +594,7 @@ int virJSONValueObjectGetNumberDouble(virJSONValuePtr object, const char *key, d } -int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key) +int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key, bool *value) { virJSONValuePtr val; if (object->type != VIR_JSON_TYPE_OBJECT) @@ -603,7 +604,7 @@ int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key) if (!val) return -1; - return virJSONValueGetBoolean(val); + return virJSONValueGetBoolean(val, value); } diff --git a/src/util/json.h b/src/util/json.h index ea28de6..4572654 100644 --- a/src/util/json.h +++ b/src/util/json.h @@ -105,7 +105,7 @@ int virJSONValueGetNumberUint(virJSONValuePtr object, unsigned int *value); int virJSONValueGetNumberLong(virJSONValuePtr object, long long *value); int virJSONValueGetNumberUlong(virJSONValuePtr object, unsigned long long *value); int virJSONValueGetNumberDouble(virJSONValuePtr object, double *value); -int virJSONValueGetBoolean(virJSONValuePtr object); +int virJSONValueGetBoolean(virJSONValuePtr object, bool *value); int virJSONValueIsNull(virJSONValuePtr object); const char *virJSONValueObjectGetString(virJSONValuePtr object, const char *key); @@ -114,7 +114,7 @@ int virJSONValueObjectGetNumberUint(virJSONValuePtr object, const char *key, uns int virJSONValueObjectGetNumberLong(virJSONValuePtr object, const char *key, long long *value); int virJSONValueObjectGetNumberUlong(virJSONValuePtr object, const char *key, unsigned long long *value); int virJSONValueObjectGetNumberDouble(virJSONValuePtr object, const char *key, double *value); -int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key); +int virJSONValueObjectGetBoolean(virJSONValuePtr object, const char *key, bool *value); int virJSONValueObjectIsNull(virJSONValuePtr object, const char *key); int virJSONValueObjectAppendString(virJSONValuePtr object, const char *key, const char *value); -- 1.7.5.rc3 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list