[libvirt] [PATCHv2 4/6] util: add new file for virTypedParameter utils

Daniel P. Berrange berrange at redhat.com
Thu Jan 19 19:01:46 UTC 2012


On Thu, Jan 19, 2012 at 11:44:44AM -0700, Eric Blake wrote:
> Preparation for another patch that refactors common patterns
> into the new file for fewer lines of code overall.
> 
> * src/util/util.h (virTypedParameterArrayClear): Move...
> * src/util/virtypedparam.h: ...to new file.
> (virTypedParameterArrayValidate, virTypedParameterAssign): New
> prototypes.
> * src/util/util.c (virTypedParameterArrayClear): Likewise.
> * src/util/virtypedparam.c: New file.
> * po/POTFILES.in: Mark file for translation.
> * src/Makefile.am (UTIL_SOURCES): Build it.
> * src/libvirt_private.syms (util.h): Split...
> (virtypedparam.h): to new section.
> (virkeycode.h): Sort.
> * daemon/remote.c: Adjust callers.
> * tools/virsh.c: Likewise.
> ---
>  daemon/remote.c          |    1 +
>  po/POTFILES.in           |    1 +
>  src/Makefile.am          |    1 +
>  src/libvirt_private.syms |   20 +++--
>  src/util/util.c          |   16 +----
>  src/util/util.h          |    4 +-
>  src/util/virtypedparam.c |  187 ++++++++++++++++++++++++++++++++++++++++++++++
>  src/util/virtypedparam.h |   37 +++++++++
>  tools/virsh.c            |    1 +
>  9 files changed, 243 insertions(+), 25 deletions(-)
>  create mode 100644 src/util/virtypedparam.c
>  create mode 100644 src/util/virtypedparam.h

ACK


> +
> +VIR_ENUM_DECL(virTypedParameter)
> +VIR_ENUM_IMPL(virTypedParameter, VIR_TYPED_PARAM_STRING + 1,

I'm slowly coming to the view that we should juust add "_LAST" to
every single one of our public enums.

But perhaps have them disabled by default, unless the app developer
does

  #define LIBVIRT_ENUM_SENTINALS

before including libvirt.h, so they make a concious decision to use a
enum value known to change.

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