[libvirt] [PATCH V6 1/3] Add a class for file descriptor sets

Eric Blake eblake at redhat.com
Sat Feb 16 00:52:08 UTC 2013


On 02/15/2013 05:43 PM, Stefan Berger wrote:
> On 02/15/2013 04:49 PM, Eric Blake wrote:
>> On 02/14/2013 05:00 AM, Stefan Berger wrote:
>>> +
>>> +    *num = fdset->nextfdset;
>>> +
>>> +    if (virHashAddEntry(fdset->aliasToFdSet, alias, num) < 0) {
>> virHashAddEntry(fdset->aliasToFdSet, alias, (void*)fdset->nextfdset);
> 
> May have to cast this to a long on 64bit machines first.

Wonder why existing uses didn't warn - oh, because they used a constant
instead of a variable.

Write it as (void*)(intptr_t)fdset->nextfdset on input, and extract it
with (int)(intptr_t)payload when printing.

> 
> util/virfdset.c: In function 'virFdSetNextSet':
> util/virfdset.c:98:25: error: cast to pointer from integer of different
> size [-Werror=int-to-pointer-cast]
> util/virfdset.c:95:35: error: unused parameter 'fdsetnum'
> [-Werror=unused-parameter]
> 
> Not nice.

But not the end of the world either - we've got other places where an
intermediate cast through intptr_t is necessary to shut up compilers.

-- 
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: 621 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20130215/1d74976a/attachment-0001.sig>


More information about the libvir-list mailing list