[Libvir] [PATCH] reindent __virErrorMsg with spaces instead of tabs

__virErrorMsg is a mix of tabs and spaces which makes it a bit hard to read. This patch cleans this up. Please apply. -- Guido --- src/virterror.c | 318 +++++++++++++++++++++++++++--------------------------- 1 files changed, 159 insertions(+), 159 deletions(-) diff --git a/src/virterror.c b/src/virterror.c index 1e39be4..f16a43c 100644 --- a/src/virterror.c +++ b/src/virterror.c @@ -425,18 +425,18 @@ __virErrorMsg(virErrorNumber error, const char *info) return (NULL); case VIR_ERR_INTERNAL_ERROR: if (info != NULL) - errmsg = _("internal error %s"); + errmsg = _("internal error %s"); else - errmsg = _("internal error"); + errmsg = _("internal error"); break; case VIR_ERR_NO_MEMORY: errmsg = _("out of memory"); break; case VIR_ERR_NO_SUPPORT: if (info == NULL) - errmsg = _("this function is not supported by the hypervisor"); - else - errmsg = _("this function is not supported by the hypervisor: %s"); + errmsg = _("this function is not supported by the hypervisor"); + else + errmsg = _("this function is not supported by the hypervisor: %s"); break; case VIR_ERR_NO_CONNECT: if (info == NULL) @@ -446,21 +446,21 @@ __virErrorMsg(virErrorNumber error, const char *info) break; case VIR_ERR_INVALID_CONN: if (info == NULL) - errmsg = _("invalid connection pointer in"); - else - errmsg = _("invalid connection pointer in %s"); + errmsg = _("invalid connection pointer in"); + else + errmsg = _("invalid connection pointer in %s"); break; case VIR_ERR_INVALID_DOMAIN: if (info == NULL) - errmsg = _("invalid domain pointer in"); - else - errmsg = _("invalid domain pointer in %s"); + errmsg = _("invalid domain pointer in"); + else + errmsg = _("invalid domain pointer in %s"); break; case VIR_ERR_INVALID_ARG: if (info == NULL) - errmsg = _("invalid argument in"); - else - errmsg = _("invalid argument in %s"); + errmsg = _("invalid argument in"); + else + errmsg = _("invalid argument in %s"); break; case VIR_ERR_OPERATION_FAILED: if (info != NULL) @@ -485,9 +485,9 @@ __virErrorMsg(virErrorNumber error, const char *info) break; case VIR_ERR_UNKNOWN_HOST: if (info != NULL) - errmsg = _("unknown host %s"); - else - errmsg = _("unknown host"); + errmsg = _("unknown host %s"); + else + errmsg = _("unknown host"); break; case VIR_ERR_SEXPR_SERIAL: if (info != NULL) @@ -501,7 +501,7 @@ __virErrorMsg(virErrorNumber error, const char *info) else errmsg = _("could not use Xen hypervisor entry %s"); break; - case VIR_ERR_NO_XENSTORE: + case VIR_ERR_NO_XENSTORE: if (info == NULL) errmsg = _("could not connect to Xen Store"); else @@ -567,150 +567,150 @@ __virErrorMsg(virErrorNumber error, const char *info) else errmsg = _("library call %s failed, possibly not supported"); break; - case VIR_ERR_XML_ERROR: - if (info == NULL) - errmsg = _("XML description not well formed or invalid"); - else - errmsg = _("XML description for %s is not well formed or invalid"); - break; - case VIR_ERR_DOM_EXIST: - if (info == NULL) - errmsg = _("this domain exists already"); - else - errmsg = _("domain %s exists already"); - break; - case VIR_ERR_OPERATION_DENIED: - if (info == NULL) - errmsg = _("operation forbidden for read only access"); - else - errmsg = _("operation %s forbidden for read only access"); - break; - case VIR_ERR_OPEN_FAILED: - if (info == NULL) - errmsg = _("failed to open configuration file for reading"); - else - errmsg = _("failed to open %s for reading"); - break; - case VIR_ERR_READ_FAILED: - if (info == NULL) - errmsg = _("failed to read configuration file"); - else - errmsg = _("failed to read configuration file %s"); - break; - case VIR_ERR_PARSE_FAILED: - if (info == NULL) - errmsg = _("failed to parse configuration file"); - else - errmsg = _("failed to parse configuration file %s"); - break; - case VIR_ERR_CONF_SYNTAX: - if (info == NULL) - errmsg = _("configuration file syntax error"); - else - errmsg = _("configuration file syntax error: %s"); - break; - case VIR_ERR_WRITE_FAILED: - if (info == NULL) - errmsg = _("failed to write configuration file"); - else - errmsg = _("failed to write configuration file: %s"); - break; - case VIR_ERR_XML_DETAIL: - if (info == NULL) - errmsg = _("parser error"); - else - errmsg = "%s"; + case VIR_ERR_XML_ERROR: + if (info == NULL) + errmsg = _("XML description not well formed or invalid"); + else + errmsg = _("XML description for %s is not well formed or invalid"); + break; + case VIR_ERR_DOM_EXIST: + if (info == NULL) + errmsg = _("this domain exists already"); + else + errmsg = _("domain %s exists already"); + break; + case VIR_ERR_OPERATION_DENIED: + if (info == NULL) + errmsg = _("operation forbidden for read only access"); + else + errmsg = _("operation %s forbidden for read only access"); + break; + case VIR_ERR_OPEN_FAILED: + if (info == NULL) + errmsg = _("failed to open configuration file for reading"); + else + errmsg = _("failed to open %s for reading"); + break; + case VIR_ERR_READ_FAILED: + if (info == NULL) + errmsg = _("failed to read configuration file"); + else + errmsg = _("failed to read configuration file %s"); + break; + case VIR_ERR_PARSE_FAILED: + if (info == NULL) + errmsg = _("failed to parse configuration file"); + else + errmsg = _("failed to parse configuration file %s"); + break; + case VIR_ERR_CONF_SYNTAX: + if (info == NULL) + errmsg = _("configuration file syntax error"); + else + errmsg = _("configuration file syntax error: %s"); + break; + case VIR_ERR_WRITE_FAILED: + if (info == NULL) + errmsg = _("failed to write configuration file"); + else + errmsg = _("failed to write configuration file: %s"); + break; + case VIR_ERR_XML_DETAIL: + if (info == NULL) + errmsg = _("parser error"); + else + errmsg = "%s"; break; case VIR_ERR_INVALID_NETWORK: if (info == NULL) - errmsg = _("invalid network pointer in"); - else - errmsg = _("invalid network pointer in %s"); - break; - case VIR_ERR_NETWORK_EXIST: - if (info == NULL) - errmsg = _("this network exists already"); - else - errmsg = _("network %s exists already"); - break; - case VIR_ERR_SYSTEM_ERROR: - if (info == NULL) - errmsg = _("system call error"); - else - errmsg = "%s"; - break; - case VIR_ERR_RPC: - if (info == NULL) - errmsg = _("RPC error"); - else - errmsg = "%s"; - break; - case VIR_ERR_GNUTLS_ERROR: - if (info == NULL) - errmsg = _("GNUTLS call error"); - else - errmsg = "%s"; - break; - case VIR_WAR_NO_NETWORK: - if (info == NULL) - errmsg = _("Failed to find the network"); - else - errmsg = _("Failed to find the network: %s"); - break; - case VIR_ERR_NO_DOMAIN: - if (info == NULL) - errmsg = _("Domain not found"); - else - errmsg = _("Domain not found: %s"); - break; - case VIR_ERR_NO_NETWORK: - if (info == NULL) - errmsg = _("Network not found"); - else - errmsg = _("Network not found: %s"); - break; - case VIR_ERR_INVALID_MAC: - if (info == NULL) - errmsg = _("invalid MAC address"); - else - errmsg = _("invalid MAC address: %s"); - break; - case VIR_ERR_AUTH_FAILED: - if (info == NULL) - errmsg = _("authentication failed"); - else - errmsg = _("authentication failed: %s"); - break; - case VIR_ERR_NO_STORAGE_POOL: - if (info == NULL) - errmsg = _("Storage pool not found"); - else - errmsg = _("Storage pool not found: %s"); - break; - case VIR_ERR_NO_STORAGE_VOL: - if (info == NULL) - errmsg = _("Storage volume not found"); - else - errmsg = _("Storage volume not found: %s"); - break; - case VIR_ERR_INVALID_STORAGE_POOL: - if (info == NULL) - errmsg = _("invalid storage pool pointer in"); - else - errmsg = _("invalid storage pool pointer in %s"); - break; - case VIR_ERR_INVALID_STORAGE_VOL: - if (info == NULL) - errmsg = _("invalid storage volume pointer in"); - else - errmsg = _("invalid storage volume pointer in %s"); - break; - case VIR_WAR_NO_STORAGE: - if (info == NULL) - errmsg = _("Failed to find a storage driver"); - else - errmsg = _("Failed to find a storage driver: %s"); - break; + errmsg = _("invalid network pointer in"); + else + errmsg = _("invalid network pointer in %s"); + break; + case VIR_ERR_NETWORK_EXIST: + if (info == NULL) + errmsg = _("this network exists already"); + else + errmsg = _("network %s exists already"); + break; + case VIR_ERR_SYSTEM_ERROR: + if (info == NULL) + errmsg = _("system call error"); + else + errmsg = "%s"; + break; + case VIR_ERR_RPC: + if (info == NULL) + errmsg = _("RPC error"); + else + errmsg = "%s"; + break; + case VIR_ERR_GNUTLS_ERROR: + if (info == NULL) + errmsg = _("GNUTLS call error"); + else + errmsg = "%s"; + break; + case VIR_WAR_NO_NETWORK: + if (info == NULL) + errmsg = _("Failed to find the network"); + else + errmsg = _("Failed to find the network: %s"); + break; + case VIR_ERR_NO_DOMAIN: + if (info == NULL) + errmsg = _("Domain not found"); + else + errmsg = _("Domain not found: %s"); + break; + case VIR_ERR_NO_NETWORK: + if (info == NULL) + errmsg = _("Network not found"); + else + errmsg = _("Network not found: %s"); + break; + case VIR_ERR_INVALID_MAC: + if (info == NULL) + errmsg = _("invalid MAC address"); + else + errmsg = _("invalid MAC address: %s"); + break; + case VIR_ERR_AUTH_FAILED: + if (info == NULL) + errmsg = _("authentication failed"); + else + errmsg = _("authentication failed: %s"); + break; + case VIR_ERR_NO_STORAGE_POOL: + if (info == NULL) + errmsg = _("Storage pool not found"); + else + errmsg = _("Storage pool not found: %s"); + break; + case VIR_ERR_NO_STORAGE_VOL: + if (info == NULL) + errmsg = _("Storage volume not found"); + else + errmsg = _("Storage volume not found: %s"); + break; + case VIR_ERR_INVALID_STORAGE_POOL: + if (info == NULL) + errmsg = _("invalid storage pool pointer in"); + else + errmsg = _("invalid storage pool pointer in %s"); + break; + case VIR_ERR_INVALID_STORAGE_VOL: + if (info == NULL) + errmsg = _("invalid storage volume pointer in"); + else + errmsg = _("invalid storage volume pointer in %s"); + break; + case VIR_WAR_NO_STORAGE: + if (info == NULL) + errmsg = _("Failed to find a storage driver"); + else + errmsg = _("Failed to find a storage driver: %s"); + break; } return (errmsg); } -- 1.5.4.3

On Sun, Mar 23, 2008 at 07:48:58PM +0100, Guido Günther wrote:
__virErrorMsg is a mix of tabs and spaces which makes it a bit hard to read. This patch cleans this up. Please apply.
Hum, could you send those kind of patches as attachments in the future ? Basically assuming spaces/tabs are correctly preserved in an email body is taking unecessary risks. Also having a name for the patch and being able to download them from on-line email archives is a good thing, Now for the content of the patch, it seems to remove all tabs and replace them with 8 spaces. Is that really a better way, why use 8 characters when you can use one for the same purpose ? One could argue either way, maybe we should standardize on tabs, maybe we should replace them all, but I'm not sure the second one is really the right way. At the moment nearly all C files uses tabs, and i know I'm using them to align parameters lists in headers too, so starting a tab replacement would hit nearly all the code. Also make sure you editor use tab to align to the next 8 character boundary. To me that renders correctly in vim (I have tabstop=8). thanks, Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

HI Daniel, On Mon, Mar 24, 2008 at 03:56:07AM -0400, Daniel Veillard wrote: > Hum, could you send those kind of patches as attachments in the future ? > Basically assuming spaces/tabs are correctly preserved in an email body is > taking unecessary risks. Also having a name for the patch and being able > to download them from on-line email archives is a good thing, O.k., fine. > Now for the content of the patch, it seems to remove all tabs and replace > them with 8 spaces. Is that really a better way, why use 8 characters when > you can use one for the same purpose ? One could argue either way, maybe No, it uses 4 spaces for each indentation level, this is what the other files I checked (mostly qemu_*.c, xml.c) use and remote_internal.c even has: /* * vim: set tabstop=4: * vim: set shiftwidth=4: * vim: set expandtab: */ which is basically what I used for reindenting virterror.c. So the patch is just to make things consistent with the rest of the c code. -- Guido

On Tue, Mar 25, 2008 at 11:06:02AM +0100, Guido Günther wrote:
HI Daniel,
Hi, [...]
Now for the content of the patch, it seems to remove all tabs and replace them with 8 spaces. Is that really a better way, why use 8 characters when you can use one for the same purpose ? One could argue either way, maybe No, it uses 4 spaces for each indentation level, this is what the other files I checked (mostly qemu_*.c, xml.c) use and remote_internal.c even has:
you just then use one tab for 2 indentation level, works just fine when I use vim on that file, really...
/* * vim: set tabstop=4: * vim: set shiftwidth=4: * vim: set expandtab: */ which is basically what I used for reindenting virterror.c. So the patch is just to make things consistent with the rest of the c code.
To me the patch I got replaced all tabs instead of using tabs for indenting of 2 levels. I also have tabstop=8 in my vim setup, that's rather classic. Daniel -- Red Hat Virtualization group http://redhat.com/virtualization/ Daniel Veillard | virtualization library http://libvirt.org/ veillard@redhat.com | libxml GNOME XML XSLT toolkit http://xmlsoft.org/ http://veillard.com/ | Rpmfind RPM search engine http://rpmfind.net/

To me the patch I got replaced all tabs instead of using tabs for indenting of 2 levels. I also have What the other libvirt code I mentioned does is: it uses spaces everywhere and no tabs. You can't mix tab with space indentation since
On Tue, Mar 25, 2008 at 06:26:02AM -0400, Daniel Veillard wrote: people tend to have 4,6 or 8 spaces/tab which tend to look funny when looked at with another setting. I don't really care too much about that patch - as I wrote already - it was mostly for consistency with the other code I looked at. If you don't like it, just drop it - no harm done. Cheers, -- Guido
participants (2)
-
Daniel Veillard
-
Guido Günther