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

[libvirt] [PATCH 01/10] maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s"



From: Jim Meyering <meyering redhat com>

Change VIR_ERROR("%s", "..."
to     VIR_ERROR0("..."

and

Change VIR_ERROR("%s", _("...")
to     VIR_ERROR0(_("...")

Use this command:
  git grep -E -l 'VIR_ERROR\("%s", (_\()?"'|xargs perl -pi -e \
  's/VIR_ERROR\("%s", (_\()?"/VIR_ERROR0($1"/'
---
 daemon/libvirtd.c      |   12 ++++++------
 src/phyp/phyp_driver.c |   16 ++++++++--------
 src/qemu/qemu_conf.c   |    4 ++--
 src/qemu/qemu_driver.c |    2 +-
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/daemon/libvirtd.c b/daemon/libvirtd.c
index cc05953..0ac1f5e 100644
--- a/daemon/libvirtd.c
+++ b/daemon/libvirtd.c
@@ -539,7 +539,7 @@ static int qemudListenUnix(struct qemud_server *server,
     char ebuf[1024];

     if (VIR_ALLOC(sock) < 0) {
-        VIR_ERROR("%s", _("Failed to allocate memory for struct qemud_socket"));
+        VIR_ERROR0(_("Failed to allocate memory for struct qemud_socket"));
         return -1;
     }

@@ -844,12 +844,12 @@ static struct qemud_server *qemudInitialize(void) {
     server->sigread = server->sigwrite = -1;

     if (virMutexInit(&server->lock) < 0) {
-        VIR_ERROR("%s", _("cannot initialize mutex"));
+        VIR_ERROR0(_("cannot initialize mutex"));
         VIR_FREE(server);
         return NULL;
     }
     if (virCondInit(&server->job) < 0) {
-        VIR_ERROR("%s", _("cannot initialize condition variable"));
+        VIR_ERROR0(_("cannot initialize condition variable"));
         virMutexDestroy(&server->lock);
         VIR_FREE(server);
         return NULL;
@@ -1359,7 +1359,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
     if (VIR_ALLOC(client) < 0)
         goto cleanup;
     if (virMutexInit(&client->lock) < 0) {
-        VIR_ERROR("%s", _("cannot initialize mutex"));
+        VIR_ERROR0(_("cannot initialize mutex"));
         VIR_FREE(client);
         goto cleanup;
     }
@@ -2771,7 +2771,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
                 maxbuf = 1024;

             if (VIR_ALLOC_N(buf, maxbuf) < 0) {
-                VIR_ERROR("%s", _("Failed to allocate memory for buffer"));
+                VIR_ERROR0(_("Failed to allocate memory for buffer"));
                 goto free_and_fail;
             }

@@ -2780,7 +2780,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
                                      &grp)) == ERANGE) {
                     maxbuf *= 2;
                     if (maxbuf > 65536 || VIR_REALLOC_N(buf, maxbuf) < 0) {
-                        VIR_ERROR("%s", _("Failed to reallocate enough memory for buffer"));
+                        VIR_ERROR0(_("Failed to reallocate enough memory for buffer"));
                         goto free_and_fail;
                     }
             }
diff --git a/src/phyp/phyp_driver.c b/src/phyp/phyp_driver.c
index 8f4f310..fbb094f 100644
--- a/src/phyp/phyp_driver.c
+++ b/src/phyp/phyp_driver.c
@@ -1233,30 +1233,30 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
                                       dom->conn);

     if (lpar_name == NULL) {
-        VIR_ERROR("%s", "Unable to determine domain's name.");
+        VIR_ERROR0("Unable to determine domain's name.");
         goto err;
     }

     if (phypGetLparUUID(def.uuid, dom->id, dom->conn) == -1) {
-        VIR_ERROR("%s", "Unable to generate random uuid.");
+        VIR_ERROR0("Unable to generate random uuid.");
         goto err;
     }

     if ((def.maxmem =
          phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) {
-        VIR_ERROR("%s", "Unable to determine domain's max memory.");
+        VIR_ERROR0("Unable to determine domain's max memory.");
         goto err;
     }

     if ((def.memory =
          phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) {
-        VIR_ERROR("%s", "Unable to determine domain's memory.");
+        VIR_ERROR0("Unable to determine domain's memory.");
         goto err;
     }

     if ((def.vcpus =
          phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) {
-        VIR_ERROR("%s", "Unable to determine domain's CPU.");
+        VIR_ERROR0("Unable to determine domain's CPU.");
         goto err;
     }

@@ -1695,7 +1695,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
     }

     if (phypUUIDTable_AddLpar(conn, def->uuid, def->id) == -1) {
-        VIR_ERROR("%s", "Unable to add LPAR to the table");
+        VIR_ERROR0("Unable to add LPAR to the table");
         goto err;
     }

@@ -1835,13 +1835,13 @@ phypUUIDTable_WriteFile(virConnectPtr conn)
         if (safewrite(fd, &uuid_table->lpars[i]->id,
                       sizeof(uuid_table->lpars[i]->id)) !=
             sizeof(uuid_table->lpars[i]->id)) {
-            VIR_ERROR("%s", "Unable to write information to local file.");
+            VIR_ERROR0("Unable to write information to local file.");
             goto err;
         }

         if (safewrite(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN) !=
             VIR_UUID_BUFLEN) {
-            VIR_ERROR("%s", "Unable to write information to local file.");
+            VIR_ERROR0("Unable to write information to local file.");
             goto err;
         }
     }
diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c
index 3e334dc..450f3dd 100644
--- a/src/qemu/qemu_conf.c
+++ b/src/qemu/qemu_conf.c
@@ -254,7 +254,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
             int ctl;
             if (pp->type != VIR_CONF_STRING) {
-                VIR_ERROR("%s", _("cgroup_controllers must be a list of strings"));
+                VIR_ERROR0(_("cgroup_controllers must be a list of strings"));
                 virConfFree(conf);
                 return -1;
             }
@@ -292,7 +292,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
         }
         for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
             if (pp->type != VIR_CONF_STRING) {
-                VIR_ERROR("%s", _("cgroup_device_acl must be a list of strings"));
+                VIR_ERROR0(_("cgroup_device_acl must be a list of strings"));
                 virConfFree(conf);
                 return -1;
             }
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index a519c02..652d3ab 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1453,7 +1453,7 @@ qemudStartup(int privileged) {
         return -1;

     if (virMutexInit(&qemu_driver->lock) < 0) {
-        VIR_ERROR("%s", _("cannot initialize mutex"));
+        VIR_ERROR0(_("cannot initialize mutex"));
         VIR_FREE(qemu_driver);
         return -1;
     }
-- 
1.7.1.259.g3aef8


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