Re: [PATCH 4/4] virCapabilitiesHostNUMAFormat: Bring variables into loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On a Monday in 2021, Michal Privoznik wrote:
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
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;

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux