On 08/08/2014 11:55 AM, Wang Rui wrote:
From: Mo Yuxiang <Moyuxiang(a)huawei.com>
On compiling libvirt-python, we get such a warning:
libvirt-qemu-override.c: In function
‘libvirt_qemu_virConnectDomainQemuMonitorEventRegister’:
libvirt-qemu-override.c:304: warning: suggest explicit braces to avoid ambiguous ‘else’
Py_DECREF is a macro. The solution is to add brackets.
s/bracket/braces/
Signed-off-by: Mo Yuxiang <Moyuxiang(a)huawei.com>
---
libvirt-qemu-override.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
ACK. This fixes compilation with python 2.6 which doesn't have the macro
wrapped in a do { } while(0) block.
I've mentioned the python version in the commit message and pushed the patch.
Jan
diff --git a/libvirt-qemu-override.c b/libvirt-qemu-override.c
index 05ead30..8be3755 100644
--- a/libvirt-qemu-override.c
+++ b/libvirt-qemu-override.c
@@ -301,8 +301,9 @@ libvirt_qemu_virConnectDomainQemuMonitorEventRegister(PyObject *self
ATTRIBUTE_U
flags);
LIBVIRT_END_ALLOW_THREADS;
- if (ret < 0)
+ if (ret < 0) {
Py_DECREF(pyobj_cbData);
+ }
py_retval = libvirt_intWrap(ret);
return py_retval;