]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: make tree listing more flexible
authorEric Blake <eblake@redhat.com>
Fri, 8 Jun 2012 21:01:08 +0000 (15:01 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 11 Jun 2012 15:23:16 +0000 (09:23 -0600)
commitc8564ad47627c29878127bcb6edfa09808198462
tree85daabb6f44e7907bcf7baa98fa4dc5af993dc9c
parentef981053ca2956a93cf547fb35cde48330e741b1
virsh: make tree listing more flexible

Requiring the user to pass in parallel arrays of names and parents
is annoying; it means that you can't qsort one of the arrays without
invalidating the ordering of the other.  By refactoring this function
to use callbacks, we isolate the layout to be independent of the
printing, and a future patch can exploit that to improve layout.

* tools/virsh.c (vshTreePrintInternal): Use callbacks rather than
requiring a char** array.
(vshTreeArrayLookup): New helper function.
(vshTreePrint, cmdNodeListDevices, cmdSnapshotList): Update callers.
tools/virsh.c