Re: [libvirt] [PATCH] mark a few diagnostics for translation

2009-01-27 Thread Jim Meyering
Jim Meyering j...@meyering.net wrote:
 Daniel P. Berrange berra...@redhat.com wrote:
 On Mon, Jan 26, 2009 at 03:05:05PM +0100, Jim Meyering wrote:
 Avoid compile-time warnings:

 From 4597152e0c4a1e4a5ee85156496a8625b5cc4f42 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Mon, 26 Jan 2009 14:54:21 +0100
 Subject: [PATCH 2/3] mark a few diagnostics for translation

 Any calls which have a VIR_ERR_NO_MEMORY can just be replaced by
 a call to virReportOOMError(). Ack to the other non-OOM error msg
 changes.

 Ok.  I've gone ahead and done those four here,

I've just comitted that and the indentation fix.
BTW, thanks for the quick feedback.

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] mark a few diagnostics for translation

2009-01-26 Thread Jim Meyering
Avoid compile-time warnings:

From 4597152e0c4a1e4a5ee85156496a8625b5cc4f42 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Mon, 26 Jan 2009 14:54:21 +0100
Subject: [PATCH 2/3] mark a few diagnostics for translation

* src/proxy_internal.c (xenProxyCommand): Mark a diagnostic.
* src/xen_unified.c (xenUnifiedOpen, xenUnifiedAddDomainInfo): Likewise.
---
 src/proxy_internal.c |6 ++
 src/xen_unified.c|   11 +++
 2 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/proxy_internal.c b/src/proxy_internal.c
index 4d8be3a..d1255ae 100644
--- a/src/proxy_internal.c
+++ b/src/proxy_internal.c
@@ -1,7 +1,7 @@
 /*
  * proxy_client.c: client side of the communication with the libvirt proxy.
  *
- * Copyright (C) 2006, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2008, 2009 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -455,7 +455,7 @@ retry:
  */
 if ((res == NULL) || (res-version != PROXY_PROTO_VERSION) ||
 (res-len  sizeof(virProxyPacket))) {
-virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+virProxyError(conn, VIR_ERR_INTERNAL_ERROR, %s,
   _(Communication error with proxy: malformed packet\n));
 goto error;
 }
@@ -1058,5 +1058,3 @@ xenProxyDomainGetOSType(virDomainPtr domain)

 return(ostype);
 }
-
-
diff --git a/src/xen_unified.c b/src/xen_unified.c
index 1a0f007..240b8f5 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -261,19 +261,21 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr 
auth, int flags)

 /* Allocate per-connection private data. */
 if (VIR_ALLOC(priv)  0) {
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _(allocating private 
data));
+xenUnifiedError (NULL, VIR_ERR_NO_MEMORY,
+ %s, _(allocating private data));
 return VIR_DRV_OPEN_ERROR;
 }
 if (virMutexInit(priv-lock)  0) {
 xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR,
- _(cannot initialise mutex));
+ %s, _(cannot initialise mutex));
 VIR_FREE(priv);
 return VIR_DRV_OPEN_ERROR;
 }

 /* Allocate callback list */
 if (VIR_ALLOC(cbList)  0) {
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _(allocating callback 
list));
+xenUnifiedError (NULL, VIR_ERR_NO_MEMORY,
+ %s, _(allocating callback list));
 virMutexDestroy(priv-lock);
 VIR_FREE(priv);
 return VIR_DRV_OPEN_ERROR;
@@ -1564,7 +1566,8 @@ xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr list,
 list-count++;
 return 0;
 memory_error:
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _(allocating domain info));
+xenUnifiedError (NULL, VIR_ERR_NO_MEMORY,
+ %s, _(allocating domain info));
 if (info)
 VIR_FREE(info-name);
 VIR_FREE(info);
--
1.6.1.1.347.g3f81d

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] mark a few diagnostics for translation

2009-01-26 Thread Daniel P. Berrange
On Mon, Jan 26, 2009 at 03:05:05PM +0100, Jim Meyering wrote:
 Avoid compile-time warnings:
 
 From 4597152e0c4a1e4a5ee85156496a8625b5cc4f42 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Mon, 26 Jan 2009 14:54:21 +0100
 Subject: [PATCH 2/3] mark a few diagnostics for translation

Any calls which have a VIR_ERR_NO_MEMORY can just be replaced by
a call to virReportOOMError(). Ack to the other non-OOM error msg
changes.

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org   -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


Re: [libvirt] [PATCH] mark a few diagnostics for translation

2009-01-26 Thread Jim Meyering
Daniel P. Berrange berra...@redhat.com wrote:
 On Mon, Jan 26, 2009 at 03:05:05PM +0100, Jim Meyering wrote:
 Avoid compile-time warnings:

 From 4597152e0c4a1e4a5ee85156496a8625b5cc4f42 Mon Sep 17 00:00:00 2001
 From: Jim Meyering meyer...@redhat.com
 Date: Mon, 26 Jan 2009 14:54:21 +0100
 Subject: [PATCH 2/3] mark a few diagnostics for translation

 Any calls which have a VIR_ERR_NO_MEMORY can just be replaced by
 a call to virReportOOMError(). Ack to the other non-OOM error msg
 changes.

Ok.  I've gone ahead and done those four here,
and am doing the remaining 200+ separately.

From e9d08816523176a35c178c6c975cd6aa55d4f5f7 Mon Sep 17 00:00:00 2001
From: Jim Meyering meyer...@redhat.com
Date: Mon, 26 Jan 2009 14:54:21 +0100
Subject: [PATCH] build: avoid format warnings

* src/proxy_internal.c (xenProxyCommand): Mark a diagnostic.
* src/xen_unified.c (xenUnifiedOpen, xenUnifiedAddDomainInfo):
Fix unmarked diagnostics by removing the diagnostic altogether:
replace each xenUnifiedError(...,VIR_ERR_NO_MEMORY call with a
call to virReportOOMError.
---
 src/proxy_internal.c |6 ++
 src/xen_unified.c|   10 +-
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/src/proxy_internal.c b/src/proxy_internal.c
index 4d8be3a..d1255ae 100644
--- a/src/proxy_internal.c
+++ b/src/proxy_internal.c
@@ -1,7 +1,7 @@
 /*
  * proxy_client.c: client side of the communication with the libvirt proxy.
  *
- * Copyright (C) 2006, 2008 Red Hat, Inc.
+ * Copyright (C) 2006, 2008, 2009 Red Hat, Inc.
  *
  * See COPYING.LIB for the License of this software
  *
@@ -455,7 +455,7 @@ retry:
  */
 if ((res == NULL) || (res-version != PROXY_PROTO_VERSION) ||
 (res-len  sizeof(virProxyPacket))) {
-virProxyError(conn, VIR_ERR_INTERNAL_ERROR,
+virProxyError(conn, VIR_ERR_INTERNAL_ERROR, %s,
   _(Communication error with proxy: malformed packet\n));
 goto error;
 }
@@ -1058,5 +1058,3 @@ xenProxyDomainGetOSType(virDomainPtr domain)

 return(ostype);
 }
-
-
diff --git a/src/xen_unified.c b/src/xen_unified.c
index 1a0f007..e70c8ac 100644
--- a/src/xen_unified.c
+++ b/src/xen_unified.c
@@ -236,7 +236,7 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr auth, 
int flags)

 conn-uri = xmlParseURI(xen:///);
 if (!conn-uri) {
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, NULL);
+virReportOOMError (NULL);
 return VIR_DRV_OPEN_ERROR;
 }
 }
@@ -261,19 +261,19 @@ xenUnifiedOpen (virConnectPtr conn, virConnectAuthPtr 
auth, int flags)

 /* Allocate per-connection private data. */
 if (VIR_ALLOC(priv)  0) {
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _(allocating private 
data));
+virReportOOMError (NULL);
 return VIR_DRV_OPEN_ERROR;
 }
 if (virMutexInit(priv-lock)  0) {
 xenUnifiedError (NULL, VIR_ERR_INTERNAL_ERROR,
- _(cannot initialise mutex));
+ %s, _(cannot initialise mutex));
 VIR_FREE(priv);
 return VIR_DRV_OPEN_ERROR;
 }

 /* Allocate callback list */
 if (VIR_ALLOC(cbList)  0) {
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _(allocating callback 
list));
+virReportOOMError (NULL);
 virMutexDestroy(priv-lock);
 VIR_FREE(priv);
 return VIR_DRV_OPEN_ERROR;
@@ -1564,7 +1564,7 @@ xenUnifiedAddDomainInfo(xenUnifiedDomainInfoListPtr list,
 list-count++;
 return 0;
 memory_error:
-xenUnifiedError (NULL, VIR_ERR_NO_MEMORY, _(allocating domain info));
+virReportOOMError (NULL);
 if (info)
 VIR_FREE(info-name);
 VIR_FREE(info);
--
1.6.1.1.347.g3f81d

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list


[libvirt] [PATCH] mark a few diagnostics for translation

2008-11-07 Thread Jim Meyering
FYI.
This is trivial, so I'll push it soon unless someone objects.

From d5d9bc7e5473ea3ce40c4af70a2085c316023723 Mon Sep 17 00:00:00 2001
From: Jim Meyering [EMAIL PROTECTED]
Date: Thu, 6 Nov 2008 20:41:34 +0100
Subject: [PATCH] mark a few diagnostics for translation

* src/lxc_conf.c (lxcLoadDriverConfig): Mark a diagnostic.
* src/lxc_driver.c (lxcDomainStart): Likewise.
* po/POTFILES.in: Add src/lxc_conf.c.
* Makefile.maint (msg_gen_function): Add virReportErrorHelper
and lxcError.
---
 Makefile.maint   |3 ++-
 po/POTFILES.in   |1 +
 src/lxc_conf.c   |5 ++---
 src/lxc_driver.c |2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/Makefile.maint b/Makefile.maint
index d856469..28b1c3f 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -353,6 +353,8 @@ msg_gen_function += qemudReportError
 msg_gen_function += openvzLog
 msg_gen_function += openvzError
 msg_gen_function += virDomainReportError
+msg_gen_function += virReportErrorHelper
+msg_gen_function += lxcError

 # Uncomment the following and run make syntax-check to see diagnostics
 # that are not yet marked for translation, but that need to be rewritten
@@ -360,7 +362,6 @@ msg_gen_function += virDomainReportError
 # msg_gen_function += error
 # msg_gen_function += virXenError
 # msg_gen_function += testError
-# msg_gen_function += lxcError

 func_or := $(shell printf '$(msg_gen_function)'|tr -s '[[:space:]]' '|')
 func_re := ($(func_or))
diff --git a/po/POTFILES.in b/po/POTFILES.in
index fdb34b5..3f8fdd2 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -7,6 +7,7 @@ src/datatypes.c
 src/domain_conf.c
 src/iptables.c
 src/libvirt.c
+src/lxc_conf.c
 src/lxc_container.c
 src/lxc_controller.c
 src/lxc_driver.c
diff --git a/src/lxc_conf.c b/src/lxc_conf.c
index 76f4e9d..0db9bb5 100644
--- a/src/lxc_conf.c
+++ b/src/lxc_conf.c
@@ -83,8 +83,7 @@ int lxcLoadDriverConfig(lxc_driver_t *driver)
 return 0;

 no_memory:
-lxcError(NULL, NULL, VIR_ERR_NO_MEMORY, configDir);
+lxcError(NULL, NULL, VIR_ERR_NO_MEMORY,
+ %s, _(while loading LXC driver config));
 return -1;
 }
-
-
diff --git a/src/lxc_driver.c b/src/lxc_driver.c
index 8bfd27d..583c4ff 100644
--- a/src/lxc_driver.c
+++ b/src/lxc_driver.c
@@ -857,7 +857,7 @@ static int lxcDomainStart(virDomainPtr dom)

 if (!vm) {
 lxcError(conn, dom, VIR_ERR_INVALID_DOMAIN,
- no domain with uuid);
+ _(no domain named %s), dom-name);
 goto cleanup;
 }

--
1.6.0.3.756.gb776d

--
Libvir-list mailing list
Libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list