struct service_instance *in;
void *c, *i;
- if (avl_is_empty(&s->instances.avl) && !verbose)
+ c = blobmsg_open_table(&b, s->name);
+
+ if (avl_is_empty(&s->instances.avl)) {
+ blobmsg_close_table(&b, c);
return;
+ }
- c = blobmsg_open_table(&b, s->name);
- if (verbose && s->trigger)
- blobmsg_add_blob(&b, s->trigger);
i = blobmsg_open_table(&b, "instances");
vlist_for_each_element(&s->instances, in, node)
instance_dump(&b, in, verbose);
blobmsg_close_table(&b, i);
+ if (verbose && s->trigger)
+ blobmsg_add_blob(&b, s->trigger);
blobmsg_close_table(&b, c);
}