maint: use VIR_ERROR0 rather than VIR_ERROR with a bare "%s"

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"/'
This commit is contained in:
Jim Meyering 2010-05-20 08:10:38 +02:00
parent c80651a5ae
commit 5910472fa5
4 changed files with 17 additions and 17 deletions

View File

@ -539,7 +539,7 @@ static int qemudListenUnix(struct qemud_server *server,
char ebuf[1024]; char ebuf[1024];
if (VIR_ALLOC(sock) < 0) { 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; return -1;
} }
@ -844,12 +844,12 @@ static struct qemud_server *qemudInitialize(void) {
server->sigread = server->sigwrite = -1; server->sigread = server->sigwrite = -1;
if (virMutexInit(&server->lock) < 0) { if (virMutexInit(&server->lock) < 0) {
VIR_ERROR("%s", _("cannot initialize mutex")); VIR_ERROR0(_("cannot initialize mutex"));
VIR_FREE(server); VIR_FREE(server);
return NULL; return NULL;
} }
if (virCondInit(&server->job) < 0) { if (virCondInit(&server->job) < 0) {
VIR_ERROR("%s", _("cannot initialize condition variable")); VIR_ERROR0(_("cannot initialize condition variable"));
virMutexDestroy(&server->lock); virMutexDestroy(&server->lock);
VIR_FREE(server); VIR_FREE(server);
return NULL; return NULL;
@ -1359,7 +1359,7 @@ static int qemudDispatchServer(struct qemud_server *server, struct qemud_socket
if (VIR_ALLOC(client) < 0) if (VIR_ALLOC(client) < 0)
goto cleanup; goto cleanup;
if (virMutexInit(&client->lock) < 0) { if (virMutexInit(&client->lock) < 0) {
VIR_ERROR("%s", _("cannot initialize mutex")); VIR_ERROR0(_("cannot initialize mutex"));
VIR_FREE(client); VIR_FREE(client);
goto cleanup; goto cleanup;
} }
@ -2771,7 +2771,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
maxbuf = 1024; maxbuf = 1024;
if (VIR_ALLOC_N(buf, maxbuf) < 0) { 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; goto free_and_fail;
} }
@ -2780,7 +2780,7 @@ remoteReadConfigFile (struct qemud_server *server, const char *filename)
&grp)) == ERANGE) { &grp)) == ERANGE) {
maxbuf *= 2; maxbuf *= 2;
if (maxbuf > 65536 || VIR_REALLOC_N(buf, maxbuf) < 0) { 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; goto free_and_fail;
} }
} }

View File

@ -1233,30 +1233,30 @@ phypDomainDumpXML(virDomainPtr dom, int flags)
dom->conn); dom->conn);
if (lpar_name == NULL) { if (lpar_name == NULL) {
VIR_ERROR("%s", "Unable to determine domain's name."); VIR_ERROR0("Unable to determine domain's name.");
goto err; goto err;
} }
if (phypGetLparUUID(def.uuid, dom->id, dom->conn) == -1) { 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; goto err;
} }
if ((def.maxmem = if ((def.maxmem =
phypGetLparMem(dom->conn, managed_system, dom->id, 0)) == 0) { 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; goto err;
} }
if ((def.memory = if ((def.memory =
phypGetLparMem(dom->conn, managed_system, dom->id, 1)) == 0) { 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; goto err;
} }
if ((def.vcpus = if ((def.vcpus =
phypGetLparCPU(dom->conn, managed_system, dom->id)) == 0) { 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; goto err;
} }
@ -1695,7 +1695,7 @@ phypBuildLpar(virConnectPtr conn, virDomainDefPtr def)
} }
if (phypUUIDTable_AddLpar(conn, def->uuid, def->id) == -1) { 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; goto err;
} }
@ -1835,13 +1835,13 @@ phypUUIDTable_WriteFile(virConnectPtr conn)
if (safewrite(fd, &uuid_table->lpars[i]->id, if (safewrite(fd, &uuid_table->lpars[i]->id,
sizeof(uuid_table->lpars[i]->id)) != sizeof(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; goto err;
} }
if (safewrite(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN) != if (safewrite(fd, uuid_table->lpars[i]->uuid, VIR_UUID_BUFLEN) !=
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; goto err;
} }
} }

View File

@ -254,7 +254,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) { for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
int ctl; int ctl;
if (pp->type != VIR_CONF_STRING) { 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); virConfFree(conf);
return -1; return -1;
} }
@ -292,7 +292,7 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
} }
for (i = 0, pp = p->list; pp; ++i, pp = pp->next) { for (i = 0, pp = p->list; pp; ++i, pp = pp->next) {
if (pp->type != VIR_CONF_STRING) { 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); virConfFree(conf);
return -1; return -1;
} }

View File

@ -1453,7 +1453,7 @@ qemudStartup(int privileged) {
return -1; return -1;
if (virMutexInit(&qemu_driver->lock) < 0) { if (virMutexInit(&qemu_driver->lock) < 0) {
VIR_ERROR("%s", _("cannot initialize mutex")); VIR_ERROR0(_("cannot initialize mutex"));
VIR_FREE(qemu_driver); VIR_FREE(qemu_driver);
return -1; return -1;
} }