From: Michal Privoznik Date: Fri, 14 May 2021 15:26:32 +0000 (+0200) Subject: virCapabilitiesHostNUMAFormat: Bring variables into loops X-Git-Tag: v7.4.0-rc1~121 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b24a45827a6b40696673b5065e3a241f846e745e;p=thirdparty%2Flibvirt.git virCapabilitiesHostNUMAFormat: Bring variables into loops Signed-off-by: Michal Privoznik Reviewed-by: Ján Tomko --- diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index 1dae6d38cc..7fe282ad3a 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -807,8 +807,6 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf, virCapsHostNUMA *caps) { size_t i; - size_t j; - char *siblings; if (!caps) return 0; @@ -819,6 +817,8 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf, virBufferAdjustIndent(buf, 2); for (i = 0; i < caps->cells->len; i++) { virCapsHostNUMACell *cell = g_ptr_array_index(caps->cells, i); + size_t j; + virBufferAsprintf(buf, "\n", cell->num); virBufferAdjustIndent(buf, 2); @@ -851,6 +851,8 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf, virBufferAsprintf(buf, "cpus[j].id); if (cell->cpus[j].siblings) { + g_autofree char *siblings = NULL; + if (!(siblings = virBitmapFormat(cell->cpus[j].siblings))) return -1; @@ -860,7 +862,6 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf, cell->cpus[j].die_id, cell->cpus[j].core_id, siblings); - VIR_FREE(siblings); } virBufferAddLit(buf, "/>\n"); }