[libvirt] [PATCH v2 2/4] virnetdev: Introduce virNetDevGetLinkInfo

Eric Blake eblake at redhat.com
Wed Jun 11 16:46:28 UTC 2014


On 06/11/2014 03:19 AM, Michal Privoznik wrote:

>>> +{
>>> +    int ret = -1;
>>> +    char *path = NULL;
>>> +    char *buf = NULL;
>>> +    char *tmp;
>>> +    int tmp_state;
>>
>> s/int/virInterfaceState/
>>
> 
> In fact this is intentional. Remember Eric's TypeFromString() patches?
> The problem is, one can't be sure if compiler decides on using unsigned
> or signed integer to represent an enum. If it decides to use an unsigned
> int (IIRC that's the case of older gcc) then comparison a few lines
> below will never be true.

But at the least, you can do:

    int tmp_state /* virInterfaceState */

to make it easier for later readers to know valid values to store in the
int.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140611/0a464884/attachment-0001.sig>


More information about the libvir-list mailing list