mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-23 06:05:27 +00:00
virQEMUCapsProbeQMPCommandLine: Rewrite using qemuMonitorGetCommandLineOptions
Use the new handler to fetch the required data and do the extraction locally without conversion to string list. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
ebeff6cd57
commit
bf8bd93df0
@ -3226,28 +3226,32 @@ static int
|
|||||||
virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps,
|
virQEMUCapsProbeQMPCommandLine(virQEMUCapsPtr qemuCaps,
|
||||||
qemuMonitorPtr mon)
|
qemuMonitorPtr mon)
|
||||||
{
|
{
|
||||||
bool found = false;
|
g_autoptr(GHashTable) options = NULL;
|
||||||
int nvalues;
|
size_t i;
|
||||||
char **values;
|
|
||||||
size_t i, j;
|
if (!(options = qemuMonitorGetCommandLineOptions(mon)))
|
||||||
|
return -1;
|
||||||
|
|
||||||
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsCommandLine); i++) {
|
for (i = 0; i < G_N_ELEMENTS(virQEMUCapsCommandLine); i++) {
|
||||||
if ((nvalues = qemuMonitorGetCommandLineOptionParameters(mon,
|
virJSONValuePtr option = g_hash_table_lookup(options, virQEMUCapsCommandLine[i].option);
|
||||||
virQEMUCapsCommandLine[i].option,
|
size_t j;
|
||||||
&values,
|
|
||||||
&found)) < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
if (found && !virQEMUCapsCommandLine[i].param)
|
if (!option)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* not looking for a specific argument */
|
||||||
|
if (!virQEMUCapsCommandLine[i].param) {
|
||||||
virQEMUCapsSet(qemuCaps, virQEMUCapsCommandLine[i].flag);
|
virQEMUCapsSet(qemuCaps, virQEMUCapsCommandLine[i].flag);
|
||||||
|
continue;
|
||||||
for (j = 0; j < nvalues; j++) {
|
}
|
||||||
if (STREQ_NULLABLE(virQEMUCapsCommandLine[i].param, values[j])) {
|
|
||||||
virQEMUCapsSet(qemuCaps, virQEMUCapsCommandLine[i].flag);
|
for (j = 0; j < virJSONValueArraySize(option); j++) {
|
||||||
break;
|
virJSONValuePtr param = virJSONValueArrayGet(option, j);
|
||||||
}
|
const char *paramname = virJSONValueObjectGetString(param, "name");
|
||||||
|
|
||||||
|
if (STREQ_NULLABLE(virQEMUCapsCommandLine[i].param, paramname))
|
||||||
|
virQEMUCapsSet(qemuCaps, virQEMUCapsCommandLine[i].flag);
|
||||||
}
|
}
|
||||||
g_strfreev(values);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user