virQEMUQAPISchemaTraverseEnum: Move helper variables into loop

Move them closer to where they are actually used.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Peter Krempa 2021-09-17 16:09:59 +02:00
parent 5f5e490c93
commit ce07b86008
1 changed files with 3 additions and 2 deletions

View File

@ -243,8 +243,6 @@ virQEMUQAPISchemaTraverseEnum(virJSONValue *cur,
{
const char *query = virQEMUQAPISchemaTraverseContextNextQuery(ctxt);
virJSONValue *values;
virJSONValue *enumval;
const char *value;
size_t i;
if (query[0] != '^')
@ -259,6 +257,9 @@ virQEMUQAPISchemaTraverseEnum(virJSONValue *cur,
return -2;
for (i = 0; i < virJSONValueArraySize(values); i++) {
virJSONValue *enumval;
const char *value;
if (!(enumval = virJSONValueArrayGet(values, i)) ||
!(value = virJSONValueGetString(enumval)))
continue;