[Pkg-libvirt-commits] [libguestfs] 25/63: launch: libvirt / p2v: Fix empty_element macro.
Hilko Bengen
bengen at moszumanska.debian.org
Fri Oct 3 14:43:26 UTC 2014
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag debian/1%1.27.39-1
in repository libguestfs.
commit 44ca9d563a93126bd744a819dde7237d371fe1fd
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Wed Sep 3 14:01:20 2014 +0100
launch: libvirt / p2v: Fix empty_element macro.
The empty_element macro was not safe when used in a "naked" if
statement such as:
if (config->flags & FLAG_ACPI) empty_element ("acpi");
Fix the macro so it uses do { ... } while (0) to make it safe here.
---
p2v/conversion.c | 3 ++-
src/launch-libvirt.c | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/p2v/conversion.c b/p2v/conversion.c
index fb17ec0..8e6aa6c 100644
--- a/p2v/conversion.c
+++ b/p2v/conversion.c
@@ -402,7 +402,8 @@ cleanup_data_conns (struct data_conn *data_conns, size_t nr)
} while (0)
/* <element/> */
-#define empty_element(element) start_element(element) {} end_element ()
+#define empty_element(element) \
+ do { start_element(element) {} end_element (); } while (0)
/* key=value attribute of the current element. */
#define attribute(key,value) \
diff --git a/src/launch-libvirt.c b/src/launch-libvirt.c
index 9bce91f..706ae38 100644
--- a/src/launch-libvirt.c
+++ b/src/launch-libvirt.c
@@ -855,7 +855,8 @@ static int construct_libvirt_xml_appliance (guestfs_h *g, const struct libvirt_x
} while (0)
/* <element/> */
-#define empty_element(element) start_element(element) {} end_element ()
+#define empty_element(element) \
+ do { start_element(element) {} end_element (); } while (0)
/* key=value attribute of the current element. */
#define attribute(key,value) \
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list