mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 19:41:16 +00:00
util: json: Make function to free JSON values in virHash universal
Move the helper that frees JSON entries put into hash tables into the JSON module so that it does not have to be reimplemented.
This commit is contained in:
parent
0feebab2c4
commit
86e51d68f9
@ -1835,6 +1835,7 @@ virJSONValueGetNumberLong;
|
||||
virJSONValueGetNumberUint;
|
||||
virJSONValueGetNumberUlong;
|
||||
virJSONValueGetString;
|
||||
virJSONValueHashFree;
|
||||
virJSONValueIsArray;
|
||||
virJSONValueIsNull;
|
||||
virJSONValueNewArray;
|
||||
|
@ -7488,14 +7488,6 @@ qemuMonitorJSONFillQMPSchema(size_t pos ATTRIBUTE_UNUSED,
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
qemuMonitorJSONFreeSchemaEntry(void *opaque,
|
||||
const void *name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virJSONValueFree(opaque);
|
||||
}
|
||||
|
||||
|
||||
virHashTablePtr
|
||||
qemuMonitorJSONQueryQMPSchema(qemuMonitorPtr mon)
|
||||
{
|
||||
@ -7516,7 +7508,7 @@ qemuMonitorJSONQueryQMPSchema(qemuMonitorPtr mon)
|
||||
|
||||
arr = virJSONValueObjectGet(reply, "return");
|
||||
|
||||
if (!(schema = virHashCreate(512, qemuMonitorJSONFreeSchemaEntry)))
|
||||
if (!(schema = virHashCreate(512, virJSONValueHashFree)))
|
||||
goto cleanup;
|
||||
|
||||
if (virJSONValueArrayForeachSteal(arr, qemuMonitorJSONFillQMPSchema,
|
||||
|
@ -376,6 +376,14 @@ virJSONValueFree(virJSONValuePtr value)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
virJSONValueHashFree(void *opaque,
|
||||
const void *name ATTRIBUTE_UNUSED)
|
||||
{
|
||||
virJSONValueFree(opaque);
|
||||
}
|
||||
|
||||
|
||||
virJSONValuePtr
|
||||
virJSONValueNewString(const char *data)
|
||||
{
|
||||
|
@ -81,6 +81,7 @@ struct _virJSONValue {
|
||||
};
|
||||
|
||||
void virJSONValueFree(virJSONValuePtr value);
|
||||
void virJSONValueHashFree(void *opaque, const void *name);
|
||||
|
||||
int virJSONValueObjectCreate(virJSONValuePtr *obj, ...)
|
||||
ATTRIBUTE_NONNULL(1) ATTRIBUTE_SENTINEL;
|
||||
|
Loading…
Reference in New Issue
Block a user