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

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



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


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