Re: [PATCH] build: avoid non-portable cast of pthread_t

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

 



On 05/03/2013 02:58 AM, Daniel P. Berrange wrote:
> On Thu, May 02, 2013 at 03:58:23PM -0600, Eric Blake wrote:
>> POSIX says pthread_t is opaque.  We can't guarantee if it is scaler
>> or a pointer, nor what size it is; and BSD differs from Linux.
>> We've also had reports of gcc complaining on attempts to cast it,
>> if we use a cast to the wrong type (for example, pointers have to be
>> cast to void* or intptr_t before being narrowed; while casting a
>> function return of pthread_t to void* triggers another warning).
>>

>> -    VIR_DEBUG("Changing job owner from %d to %d",
>> +    VIR_DEBUG("Changing job owner from %lld to %lld",
> 
> s/lld/llu/  since you declared it unsigned

Sure, easy enough to do.

> 
>>                priv->job.owner, virThreadSelfID());
>>      priv->job.owner = virThreadSelfID();
>>  }
>> @@ -846,7 +846,7 @@ qemuDomainObjSetJobPhase(virQEMUDriverPtr driver,
>>                           int phase)
>>  {
>>      qemuDomainObjPrivatePtr priv = obj->privateData;
>> -    int me = virThreadSelfID();
>> +    unsigned long long int me = virThreadSelfID();
> 
> s/int//;  'unsigned long long' is verbose enough already without
> adding a redundent 'int' suffix on it too. Same throughout this
> patch.

Consider it done :)

Will push shortly with those fixes.

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

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[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]