[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCHv2 4/7] snapshot: virsh fallback for snapshot-list --from children

On 10/09/2011 09:23 PM, Daniel Veillard wrote:
On Fri, Sep 30, 2011 at 05:09:26PM -0600, Eric Blake wrote:
Iterating over one level of children requires parsing all snapshots
and their parents; a bit of code shuffling makes it pretty easy
to do this as well.

-    if (tree) {
-        char indentBuf[INDENT_BUFLEN];
-        char **parents = vshCalloc(ctl, sizeof(char *), actual);
+    if (!tree)
+        qsort(&names[0], actual, sizeof(char*), namesorter);

I had to rebase a bit here because of the bug fix in 40baa1c, but nothing too radical.

   Okay, getting parents global to the function as well as associated
cleanup looks a bit simpler actually.

Yeah, I was pleasantly surprised at how the function got easier to read even as it supported more fallbacks than before.

Eric Blake   eblake redhat com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]