
Hi, Here are 2 cleanup patches for 2 smallish issues I found when looking at how virHash was used in libvirt. Christophe

There were several occurrences of an extra space inserted between a function name and the ( opening the argument list in datatypes.c. This is not consistent with the coding style used in the rest of this file so removing this extra space makes the code slightly more readable. --- src/datatypes.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/datatypes.c b/src/datatypes.c index 7cc37c1..1b68f6a 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -243,19 +243,19 @@ virReleaseConnect(virConnectPtr conn) { virMutexUnlock(&conn->lock); if (conn->networkDriver) - conn->networkDriver->close (conn); + conn->networkDriver->close(conn); if (conn->interfaceDriver) - conn->interfaceDriver->close (conn); + conn->interfaceDriver->close(conn); if (conn->storageDriver) - conn->storageDriver->close (conn); + conn->storageDriver->close(conn); if (conn->deviceMonitor) - conn->deviceMonitor->close (conn); + conn->deviceMonitor->close(conn); if (conn->secretDriver) - conn->secretDriver->close (conn); + conn->secretDriver->close(conn); if (conn->nwfilterDriver) - conn->nwfilterDriver->close (conn); + conn->nwfilterDriver->close(conn); if (conn->driver) - conn->driver->close (conn); + conn->driver->close(conn); virMutexLock(&conn->lock); -- 1.7.4

On 02/17/2011 02:18 PM, Christophe Fergeau wrote:
There were several occurrences of an extra space inserted between a function name and the ( opening the argument list in datatypes.c. This is not consistent with the coding style used in the rest of this file so removing this extra space makes the code slightly more readable. --- src/datatypes.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c index 7cc37c1..1b68f6a 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -243,19 +243,19 @@ virReleaseConnect(virConnectPtr conn) { virMutexUnlock(&conn->lock);
if (conn->networkDriver) - conn->networkDriver->close (conn); + conn->networkDriver->close(conn);
ACK and pushed. In the past, there has been talk about running the entire code base through a formatting tool, but we haven't yet found one that quite matches existing coding style, so it has been a series of manually touching up inconsistencies while in the area. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org

2011/2/18 Eric Blake <eblake@redhat.com>:
On 02/17/2011 02:18 PM, Christophe Fergeau wrote:
There were several occurrences of an extra space inserted between a function name and the ( opening the argument list in datatypes.c. This is not consistent with the coding style used in the rest of this file so removing this extra space makes the code slightly more readable. --- src/datatypes.c | 14 +++++++------- 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/datatypes.c b/src/datatypes.c index 7cc37c1..1b68f6a 100644 --- a/src/datatypes.c +++ b/src/datatypes.c @@ -243,19 +243,19 @@ virReleaseConnect(virConnectPtr conn) { virMutexUnlock(&conn->lock);
if (conn->networkDriver) - conn->networkDriver->close (conn); + conn->networkDriver->close(conn);
ACK and pushed.
In the past, there has been talk about running the entire code base through a formatting tool, but we haven't yet found one that quite matches existing coding style, so it has been a series of manually touching up inconsistencies while in the area.
I tried to use uncrustify [1]. It has tones of options to configure the style. I tweaked it's default config file to match libvirt's style. Works quite well, but there are still some issues left with how it breaks certain long functions calls and if statements. I attached my config so you can give it a try if you like :) [1] http://uncrustify.sourceforge.net/

--- src/qemu/qemu_command.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c9feb9b..371a7ed 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4243,7 +4243,6 @@ qemuBuildCommandLine(virConnectPtr conn, if (configfd >= 0) { if (virAsprintf(&configfd_name, "%d", configfd) < 0) { VIR_FORCE_CLOSE(configfd); - virReportOOMError(); goto no_memory; } -- 1.7.4

On 02/17/2011 02:18 PM, Christophe Fergeau wrote:
--- src/qemu/qemu_command.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c9feb9b..371a7ed 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -4243,7 +4243,6 @@ qemuBuildCommandLine(virConnectPtr conn, if (configfd >= 0) { if (virAsprintf(&configfd_name, "%d", configfd) < 0) { VIR_FORCE_CLOSE(configfd); - virReportOOMError(); goto no_memory;
ACK and pushed. -- Eric Blake eblake@redhat.com +1-801-349-2682 Libvirt virtualization library http://libvirt.org
participants (3)
-
Christophe Fergeau
-
Eric Blake
-
Matthias Bolte