qemuMonitorJSONGetStringArray: Don't return element count

There's just one caller who cares (testQemuMonitorJSONGetTPMModels). Fix
it and remove the counting of elements.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-06-14 16:41:09 +02:00
parent a5bc5f0ecf
commit 99908b930d
2 changed files with 5 additions and 7 deletions

View File

@ -7219,7 +7219,7 @@ qemuMonitorJSONGetStringArray(qemuMonitor *mon,
if (!(*array = virJSONValueObjectGetStringArray(reply, "return")))
return -1;
return g_strv_length(*array);
return 0;
}
int qemuMonitorJSONGetTPMModels(qemuMonitor *mon,

View File

@ -561,7 +561,6 @@ testQemuMonitorJSONGetTPMModels(const void *opaque)
const testGenericData *data = opaque;
virDomainXMLOption *xmlopt = data->xmlopt;
g_auto(GStrv) tpmmodels = NULL;
int ntpmmodels = 0;
g_autoptr(qemuMonitorTest) test = NULL;
if (!(test = qemuMonitorTestNewSchema(xmlopt, data->schema)))
@ -575,13 +574,12 @@ testQemuMonitorJSONGetTPMModels(const void *opaque)
"}") < 0)
return -1;
if ((ntpmmodels = qemuMonitorGetTPMModels(qemuMonitorTestGetMonitor(test),
&tpmmodels)) < 0)
if (qemuMonitorGetTPMModels(qemuMonitorTestGetMonitor(test), &tpmmodels) < 0)
return -1;
if (ntpmmodels != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR,
"ntpmmodels %d is not 1", ntpmmodels);
if (g_strv_length(tpmmodels) != 1) {
virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
"expected 1 tpm model");
return -1;
}