From: Peter Krempa Date: Mon, 30 Nov 2020 16:08:46 +0000 (+0100) Subject: qemuMonitorCreateObjectPropsWrap: Open-code in qemuBuildMemoryBackendProps X-Git-Tag: v7.2.0-rc1~34 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=71828a7bc0646ef834af37509fa8300ef4e74340;p=thirdparty%2Flibvirt.git qemuMonitorCreateObjectPropsWrap: Open-code in qemuBuildMemoryBackendProps There's just one caller left. Since qemuBuildMemoryBackendProps is too complex to be modified for now, just move the adding of 'id' and 'qom' type directly into the function. Signed-off-by: Peter Krempa Reviewed-by: Michal Privoznik --- diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5717f7b98d..b60f297331 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -3284,10 +3284,12 @@ qemuBuildMemoryBackendProps(virJSONValuePtr *backendProps, rc = 0; } - if (!(*backendProps = qemuMonitorCreateObjectPropsWrap(backendType, alias, - &props))) + if (virJSONValueObjectPrependString(props, "id", alias) < 0 || + virJSONValueObjectPrependString(props, "qom-type", backendType) < 0) return -1; + *backendProps = g_steal_pointer(&props); + return rc; } diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 579d98b42f..1709f7e52c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -3015,21 +3015,6 @@ qemuMonitorAddDeviceArgs(qemuMonitorPtr mon, } -virJSONValuePtr -qemuMonitorCreateObjectPropsWrap(const char *type, - const char *alias, - virJSONValuePtr *props) -{ - - if (virJSONValueObjectPrependString(*props, "id", alias) < 0 || - virJSONValueObjectPrependString(*props, "qom-type", type)) - return NULL; - - return g_steal_pointer(props); -} - - - /** * qemuMonitorCreateObjectProps: * @propsret: returns full object properties diff --git a/src/qemu/qemu_monitor.h b/src/qemu/qemu_monitor.h index c812aa9cc3..9106f966da 100644 --- a/src/qemu/qemu_monitor.h +++ b/src/qemu/qemu_monitor.h @@ -1006,10 +1006,6 @@ int qemuMonitorAddDeviceWithFd(qemuMonitorPtr mon, int qemuMonitorDelDevice(qemuMonitorPtr mon, const char *devalias); -virJSONValuePtr qemuMonitorCreateObjectPropsWrap(const char *type, - const char *alias, - virJSONValuePtr *props); - int qemuMonitorCreateObjectProps(virJSONValuePtr *propsret, const char *type, const char *alias,