[libvirt] [PATCH 03/13] Rewrite virAtomic APIs using GLib's atomic ops code
Eric Blake
eblake at redhat.com
Mon Jul 16 23:27:06 UTC 2012
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 at redhat.com>
>>>
>>> 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 at 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: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120716/e2e41d75/attachment-0001.sig>
More information about the libvir-list
mailing list