[PATCH 4/4] virCapabilitiesHostNUMAFormat: Bring variables into loops
Ján Tomko
jtomko at jtomko.net
Mon May 17 13:46:06 UTC 2021
On a Monday in 2021, Michal Privoznik wrote:
>Signed-off-by: Michal Privoznik <mprivozn at redhat.com>
>---
> src/conf/capabilities.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
>
>diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c
>index 1dae6d38cc..915cd3149e 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, "<cell id='%d'>\n", cell->num);
> virBufferAdjustIndent(buf, 2);
>
>@@ -847,10 +847,12 @@ virCapabilitiesHostNUMAFormat(virBuffer *buf,
>
> virBufferAsprintf(buf, "<cpus num='%d'>\n", cell->ncpus);
> virBufferAdjustIndent(buf, 2);
>- for (j = 0; j < cell->ncpus; j++) {
>+ for (j = 0; j < cell->ncpus; ++j) {
No need to change the post-increment to pre-increment.
Jano
> virBufferAsprintf(buf, "<cpu id='%d'", cell->cpus[j].id);
>
> if (cell->cpus[j].siblings) {
>+ g_autofree char * siblings = NULL;
>+
> if (!(siblings = virBitmapFormat(cell->cpus[j].siblings)))
> return -1;
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20210517/6ad7adc1/attachment-0001.sig>
More information about the libvir-list
mailing list