On 9/28/18 11:31 AM, Max Reitz wrote:
On 23.08.18 17:46, Vladimir Sementsov-Ogievskiy wrote:
Add a new command, returning block nodes (and their users) graph.


Drive-by comment without actually reading the patch yet:

+++ b/block.c
@@ -4003,6 +4003,135 @@ BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp)
      return list;
  }
+#define QAPI_LIST_ADD(list, element) do { \
+    typeof(list) _tmp = g_new(typeof(*(list)), 1); \
+    _tmp->value = (element); \
+    _tmp->next = (list); \
+    list = _tmp; \

Interesting, how yoo put (list) as an rvalue in parentheses, but don't
do so when it's an lvalue. :-)

I can follow your line of thinking, but it should probably always be in
parentheses.

This macro seems rather handy. How much else in the code base would benefit if we promote this into something officially provided by qapi code (probably in qlist.h) rather than making multiple callsites repeat the boilerplate?

--
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to