[libvirt PATCH 23/24] tests: vir: remove pointless labels

Laine Stump laine at redhat.com
Thu Sep 9 15:10:08 UTC 2021


On 9/9/21 10:28 AM, Ján Tomko wrote:
> On a Monday in 2021, Laine Stump wrote:
>> On 9/4/21 4:44 PM, Ján Tomko wrote:
>>
>>> @@ -319,9 +308,9 @@ testFileIsSharedFSType(const void *opaque 
>>> G_GNUC_UNUSED)
>>>      return EXIT_AM_SKIP;
>>>  #else
>>>      const struct testFileIsSharedFSType *data = opaque;
>>> +    int ret = -1;
>>>      g_autofree char *mtabFile = NULL;
>>>      bool actual;
>>> -    int ret = -1;
>>
>> unrelated (well, only peripherally related) code movement.
>>
>> [...]
>>
>>
>>> @@ -199,15 +195,15 @@ testVirPCIDeviceReattach(const void *opaque 
>>> G_GNUC_UNUSED)
>>>      for (i = 0; i < nDev; i++) {
>>>          if (virPCIDeviceReattach(dev[i], activeDevs, inactiveDevs) < 0)
>>> -            goto cleanup;
>>> +            return -1;
>>>          CHECK_LIST_COUNT(activeDevs, 0);
>>>          CHECK_LIST_COUNT(inactiveDevs, nDev - i - 1);
>>>      }
>>> -    ret = 0;
>>> +    return 0;
>>>   cleanup:
>>> -    return ret;
>>> +    return -1;
>>>  }
>>
>>
>> Oops. You forgot one! cleanup is no longer referenced, but you didn't 
>> remove it (or the dead code "return -1;" following it)
>>
> 
> 'cleanup' is still referenced inside the 'CHECK_LIST_COUNT' macro,
> which is also used by testVirPCIDeviceReset and testVirPCIDeviceDetach.


Ewww, ... er, I mean "Oh. Interesting." Well at least that explains why 
it still compiled, so I don't have to lose sleep over that any more :-)

> 
> On second thought, mixing returns with cleanups does not seem like
> a good idea and I will drop this partial conversion before pushing.
> 
> Jano




More information about the libvir-list mailing list