[libvirt] [PATCH] xml: Use virXMLParse* helpers everywhere
Eric Blake
eblake at redhat.com
Fri May 13 00:53:53 UTC 2011
On 05/12/2011 03:47 PM, Cole Robinson wrote:
> virt-aa-helper isn't even compile tested since I don't have the setup for
> it.
I tested the patch out on Ubuntu, and the virt-aa-helper stuff did
indeed have problems.
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
> src/conf/domain_conf.c | 33 ++++--------------
> src/conf/nwfilter_conf.c | 76 ++++-------------------------------------
> src/conf/storage_conf.c | 8 +----
> src/esx/esx_vi.c | 14 +------
> src/security/virt-aa-helper.c | 43 +----------------------
> src/test/test_driver.c | 17 +--------
> 6 files changed, 21 insertions(+), 170 deletions(-)
Nice reduction in size!
> +++ b/src/security/virt-aa-helper.c
> @@ -592,29 +592,6 @@ valid_path(const char *path, const bool readonly)
> return 0;
> }
>
> @@ -658,31 +635,15 @@ static int
> caps_mockup(vahControl * ctl, const char *xmlStr)
> {
> int rc = -1;
> - xmlParserCtxtPtr pctxt = NULL;
Missed a use of this.
> -
> - if ((root = xmlDocGetRootElement(xml)) == NULL) {
> - vah_error(NULL, 0, _("missing root element"));
> + if (!(xml = virXMLParseString(xmlStr, "domain.xml"))) {
Needs VIR_FROM_THIS.
ACK with this squashed in:
diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c
index a14fb77..41ba4a3 100644
--- a/src/security/virt-aa-helper.c
+++ b/src/security/virt-aa-helper.c
@@ -42,6 +42,8 @@
#include "files.h"
#include "configmake.h"
+#define VIR_FROM_THIS VIR_FROM_SECURITY
+
static char *progname;
typedef struct {
@@ -686,7 +688,6 @@ caps_mockup(vahControl * ctl, const char *xmlStr)
rc = 0;
cleanup:
- xmlFreeParserCtxt (pctxt);
xmlFreeDoc (xml);
xmlXPathFreeContext(ctxt);
--
1.7.4.4
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110512/271b303d/attachment-0001.sig>
More information about the libvir-list
mailing list