[libvirt] [PATCH] virsh: Allow users to reedit rejected XML
Daniel P. Berrange
berrange at redhat.com
Fri May 11 14:46:31 UTC 2012
On Fri, May 11, 2012 at 10:28:52AM -0400, Laine Stump wrote:
>
> I agree that the code should only be there once, but rather than
> creating all the other versions with a strange sed script in the
> makefile, I think the correct solution is the more usual/accepted method
> of making a generic helper function that parameterizes everything that
> is different between the different types of edit, with a short function
> for each version that calls this helper function. (I have this bad
> feeling that I once promised to do that, but then forgot and never made
> good on my promise :-/)
>
> (or alternately, doing it with a macro as Dan suggests. That makes for a
> pretty long macro, though :-)
Not neccessarily. You can have the "edit" function in a separate file
virsh-edit.c, which you then #include several times
#define EDIT_TYPE virDomainPtr
#define EDIT_API virDomainDefine
#include "virsh-edit.c"
#define EDIT_TYPE virNetworkPtr
#define EDIT_API virNetworkDefine
#include "virsh-edit.c"
etc
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|
More information about the libvir-list
mailing list