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

Michal Prívozník mprivozn at redhat.com
Mon May 17 13:57:22 UTC 2021


On 5/17/21 3:46 PM, Ján Tomko wrote:
> 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.

Huh, I have no idea how that slipped in there :-)

Michal




More information about the libvir-list mailing list