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

Re: [libvirt] [PATCH v2] Fixed URI parsing



On Fri, Feb 24, 2012 at 02:30:11PM +0100, Martin Kletzander wrote:
> Function xmlParseURI does not remove square brackets around IPv6
> address when parsing. One of the solutions is making wrappers around
> functions working with xmlURI*. This assures that uri->server will be
> always properly assigned and it doesn't have to be changed when used
> on some new place in the code.
> For this purpose, functions virParseURI and virSaveURI were
> added. These function are wrappers around xmlParseURI and xmlSaveUri
> respectively.


> diff --git a/src/util/xml.h b/src/util/xml.h
> index a3750fa..4835900 100644
> --- a/src/util/xml.h
> +++ b/src/util/xml.h
> @@ -10,6 +10,7 @@
>  # include <libxml/parser.h>
>  # include <libxml/tree.h>
>  # include <libxml/xpath.h>
> +# include <libxml/uri.h>
> 
>  int              virXPathBoolean(const char *xpath,
>                                   xmlXPathContextPtr ctxt);
> @@ -61,6 +62,10 @@ xmlDocPtr      virXMLParseHelper(int domcode,
>                                   const char *url,
>                                   xmlXPathContextPtr *pctxt);
> 
> +xmlURIPtr            virParseURI(const char *uri);
> +
> +unsigned char *       virSaveURI(xmlURIPtr uri);
> +

Can you create new files for these  'util/viruri.{h,c}' and change
to ensure a standard 'virURI' naming prefix. Also we tend to use
the pair  Parse/Format, rather than Parse/Save in libvirt code.

So eg create a file viruri.h containing:

   typedef virURIPtr xmlURIPtr;

   virURIPtr  virURIParse(const char *uri);
   char *     virURIFormat(virURIPtr uri);

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


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