[Libosinfo] [libosinfo 2/6] loader: Use OSINFO_LOADER_SET_ERROR in a few more places

Christophe Fergeau cfergeau at redhat.com
Thu Sep 20 13:59:18 UTC 2018


There are 2 calls to g_set_error(err, "%s", "constant string"); which
can be replaced with OSINFO_LOADER_SET_ERROR
---
 osinfo/osinfo_loader.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/osinfo/osinfo_loader.c b/osinfo/osinfo_loader.c
index d7f1ab13..3accb29e 100644
--- a/osinfo/osinfo_loader.c
+++ b/osinfo/osinfo_loader.c
@@ -313,14 +313,12 @@ osinfo_loader_doc(const char *xpath,
 
     if (!(buf = xmlBufferCreate())) {
         xmlXPathFreeObject(obj);
-        g_set_error(err, 0, 0, "%s",
-                    "Cannot allocate buffer");
+        OSINFO_LOADER_SET_ERROR(err, "Cannot allocate buffer");
         return NULL;
     }
     if (xmlNodeDump(buf, NULL, obj->nodesetval->nodeTab[0], 0, 1) < 0) {
         xmlXPathFreeObject(obj);
-        g_set_error(err, 0, 0, "%s",
-                    "Cannot format stylesheet");
+        OSINFO_LOADER_SET_ERROR(err, "Cannot format stylesheet");
     }
     ret = g_strdup((char *)buf->content);
 
-- 
2.19.0




More information about the Libosinfo mailing list