Re: [PATCH 03/13] Rewrite virAtomic APIs using GLib's atomic ops code

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

 



On 07/16/2012 09:45 AM, Daniel P. Berrange wrote:
> On Fri, Jul 13, 2012 at 03:44:03PM -0600, Eric Blake wrote:
>> On 07/11/2012 07:35 AM, Daniel P. Berrange wrote:
>>> From: "Daniel P. Berrange" <berrange@xxxxxxxxxx>
>>>
>>> There are a few issues with the current virAtomic APIs
>>>

>>> +
>>> +#  define virAtomicIntGet(atomic)               \
>>> +    virAtomicIntGet((int *)atomic)
>>
>> What are these macro casts for?  You are not properly parenthesizing
>> things, and didn't the glib definition already check that the right size
>> was being passed in?
> 
> With the inline GCC macros we can pass either 'int' or 'unsigned int'
> with no warnings. When we use the WIn32/pthread helper functions though,
> we would get compiler warnings from mixed-sign ints. These macro casts
> get around that.

Fair enough, but a comment in the code before the defines would go a
long way to help the next reader.  Looking forward to v2.

-- 
Eric Blake   eblake@xxxxxxxxxx    +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]