]> git.ipfire.org Git - thirdparty/libvirt.git/commit
virsh: make ,, escape parsing common
authorEric Blake <eblake@redhat.com>
Wed, 7 Nov 2012 00:45:09 +0000 (17:45 -0700)
committerEric Blake <eblake@redhat.com>
Wed, 7 Nov 2012 16:01:37 +0000 (09:01 -0700)
commit9d91a18ebf1594e76ff26d79e799763efc6b1cac
tree65e659c86927f5670cc7681bbfdd5e9f39c6a5ad
parenta08fc66d900a09b2f15f910fcfb6a80985313c2c
virsh: make ,, escape parsing common

So far, none of the existing callers of vshStringToArray expected
the user to ever pass a literal comma; meanwhile, snapshot parsing
had rolled its own array parser.  Moving the comma escaping into
the common function won't affect any existing callers, and will make
this function reusable for adding memory handling to snapshot parsing.

As a bonus, the testsuite was already testing snapshot parsing, so
the fact that the test still passes means that we are now giving
testsuite exposure to vshStringToArray.

* tools/virsh-snapshot.c (vshParseSnapshotDiskspec): Move ,,
parsing...
* tools/virsh.c (vshStringToArray): ...into common function.
Also, vshStrdup can't fail.
tools/virsh-snapshot.c
tools/virsh.c