mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virQEMUBuildCommandLineJSONIterate: Simplify logic
With automatic memory freeing we can simplify the function to avoid two almost-identical calls to virQEMUBuildCommandLineJSONRecurse. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
fbc088ab82
commit
5204578993
@ -158,23 +158,17 @@ virQEMUBuildCommandLineJSONIterate(const char *key,
|
||||
void *opaque)
|
||||
{
|
||||
struct virQEMUCommandLineJSONIteratorData *data = opaque;
|
||||
g_autofree char *tmpkey = NULL;
|
||||
|
||||
if (STREQ_NULLABLE(key, data->skipKey))
|
||||
return 0;
|
||||
|
||||
if (data->prefix) {
|
||||
g_autofree char *tmpkey = NULL;
|
||||
if (data->prefix)
|
||||
key = tmpkey = g_strdup_printf("%s.%s", data->prefix, key);
|
||||
|
||||
tmpkey = g_strdup_printf("%s.%s", data->prefix, key);
|
||||
|
||||
return virQEMUBuildCommandLineJSONRecurse(tmpkey, value, data->buf,
|
||||
data->skipKey,
|
||||
data->arrayFunc, false);
|
||||
} else {
|
||||
return virQEMUBuildCommandLineJSONRecurse(key, value, data->buf,
|
||||
data->skipKey,
|
||||
data->arrayFunc, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user