[libvirt] [PATCH] build: avoid non-portable cast of pthread_t
Eric Blake
eblake at redhat.com
Fri May 3 12:05:07 UTC 2013
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
-------------- 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/20130503/edb8f76f/attachment-0001.sig>
More information about the libvir-list
mailing list