Re: [PATCH] virsh: Allow users to reedit rejected XML

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

 



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 :|

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]