[libvirt] [PATCH 3/3] Move virEmitXMLWarning into xml.h

Eric Blake eblake at redhat.com
Fri Jan 27 17:56:27 UTC 2012


On 01/27/2012 10:37 AM, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
> 
> The virEmitXMLWarning function should always have been in
> the xml.[hc] files, and should use virXML as its name
> prefix
> 
> * src/util/util.c, src/util/util.h: Remove virEmitXMLWarning
> * src/util/xml.c, src/util/xml.h: Add virXMLEmitWarning
> ---
>  src/util/util.c |   39 ---------------------------------------
>  src/util/util.h |    4 ----
>  src/util/xml.c  |   41 ++++++++++++++++++++++++++++++++++++++++-
>  src/util/xml.h  |    5 +++++
>  4 files changed, 45 insertions(+), 44 deletions(-)

Another mechanical move.  ACK with the following changes.

You forgot to also move the function declaration in
libvirt_private.syms.  And since no one outside of xml.c calls it, you
might as well make it static and removing both the export in
libvirt_private.syms, as well as:

> +++ b/src/util/xml.c
> @@ -813,7 +813,7 @@ virXMLRewriteFile(int fd, void *opaque)
>      struct virXMLRewritFileData *data = opaque;
>  
>      if (data->warnName && data->warnCommand) {
> -        if (virEmitXMLWarning(fd, data->warnName, data->warnCommand) < 0)
> +        if (virXMLEmitWarning(fd, data->warnName, data->warnCommand) < 0)
>              return -1;
>      }
>  
> @@ -853,3 +853,42 @@ virXMLChildElementCount(xmlNodePtr node)
>      }
>      return ret;
>  }
> +
> +int virXMLEmitWarning(int fd,
> +                      const char *name,
> +                      const char *cmd) {

either add a prototype or float this function to occur before its use
when making it static, and

>> +++ b/src/util/xml.h
> @@ -144,4 +144,9 @@ int virXMLSaveFile(const char *path,
>                     const char *warnCommand,
>                     const char *xml);
>  
> +int virXMLEmitWarning(int fd,
> +                      const char *name,
> +                      const char *cmd) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3);
> +

Drop this hunk, since no one else uses it.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120127/8ad64715/attachment-0001.sig>


More information about the libvir-list mailing list