[libvirt] [PATCH 04/12] storage_conf: Use xmlStrEqual instead of STREQ

Osier Yang jyang at redhat.com
Wed May 22 12:05:14 UTC 2013


And improve the error message
---
 src/conf/storage_conf.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/conf/storage_conf.c b/src/conf/storage_conf.c
index 6f89f1c..5c8577e 100644
--- a/src/conf/storage_conf.c
+++ b/src/conf/storage_conf.c
@@ -975,9 +975,11 @@ virStoragePoolDefParseNode(xmlDocPtr xml,
     xmlXPathContextPtr ctxt = NULL;
     virStoragePoolDefPtr def = NULL;
 
-    if (STRNEQ((const char *)root->name, "pool")) {
+    if (!xmlStrEqual(root->name, BAD_CAST "pool")) {
         virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("unknown root element for storage pool"));
+                       _("unexpected root element <%s>, "
+                         "expecting <pool>"),
+                       root->name);
         goto cleanup;
     }
 
@@ -1353,9 +1355,11 @@ virStorageVolDefParseNode(virStoragePoolDefPtr pool,
     xmlXPathContextPtr ctxt = NULL;
     virStorageVolDefPtr def = NULL;
 
-    if (STRNEQ((const char *)root->name, "volume")) {
+    if (!xmlStrEqual(root->name, BAD_CAST "volume")) {
         virReportError(VIR_ERR_XML_ERROR,
-                       "%s", _("unknown root element for storage vol"));
+                       _("unexpected root element <%s>, "
+                         "expecting <volume>"),
+                       root->name);
         goto cleanup;
     }
 
-- 
1.8.1.4




More information about the libvir-list mailing list