[libvirt] [dbus PATCH 0/2] misc fixes

Pavel Hrdina (2): Initialize struct using 0 instead of NULL util: Introduce virtDBusUtilAutoLock src/connect.c | 6 +++--- src/domain.c | 4 ++-- src/gdbus.c | 4 ++-- src/main.c | 2 +- src/util.h | 2 ++ 5 files changed, 10 insertions(+), 8 deletions(-) -- 2.14.3

Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/connect.c | 4 ++-- src/domain.c | 4 ++-- src/gdbus.c | 4 ++-- src/main.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/connect.c b/src/connect.c index 56ead8d..c6b85ce 100644 --- a/src/connect.c +++ b/src/connect.c @@ -281,7 +281,7 @@ virtDBusDomainLookupByUUID(GVariant *inArgs, static virtDBusGDBusPropertyTable virtDBusConnectPropertyTable[] = { { "Version", virtDBusConnectGetVersion, NULL }, - { NULL, NULL, NULL } + { 0 } }; static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = { @@ -291,7 +291,7 @@ static virtDBusGDBusMethodTable virtDBusConnectMethodTable[] = { { "DomainLookupByID", virtDBusDomainLookupByID }, { "DomainLookupByName", virtDBusDomainLookupByName }, { "DomainLookupByUUID", virtDBusDomainLookupByUUID }, - { NULL, NULL } + { 0 } }; static GDBusInterfaceInfo *interfaceInfo = NULL; diff --git a/src/domain.c b/src/domain.c index 3c09351..1b9c685 100644 --- a/src/domain.c +++ b/src/domain.c @@ -459,7 +459,7 @@ static virtDBusGDBusPropertyTable virtDBusDomainPropertyTable[] = { { "Persistent", virtDBusDomainGetPersistent, NULL }, { "State", virtDBusDomainGetState, NULL }, { "Autostart", virtDBusDomainGetAutostart, NULL }, - { NULL, NULL, NULL } + { 0 } }; static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { @@ -472,7 +472,7 @@ static virtDBusGDBusMethodTable virtDBusDomainMethodTable[] = { { "Reset", virtDBusDomainReset }, { "Create", virtDBusDomainCreate }, { "Undefine", virtDBusDomainUndefine }, - { NULL, NULL } + { 0 } }; static gchar ** diff --git a/src/gdbus.c b/src/gdbus.c index 6abcc28..cb06813 100644 --- a/src/gdbus.c +++ b/src/gdbus.c @@ -294,7 +294,7 @@ static const GDBusInterfaceVTable virtDBusGDBusVtable = { virtDBusGDBusHandleMethodCall, NULL, NULL, - { NULL } + { 0 } }; /** @@ -378,7 +378,7 @@ static const GDBusSubtreeVTable virtDBusGDBusSubreeVtable = { virtDBusGDBusEnumerate, virtDBusGDBusIntrospect, virtDBusGDBusDispatch, - { NULL } + { 0 } }; static void diff --git a/src/main.c b/src/main.c index 7afde4f..b3baf76 100644 --- a/src/main.c +++ b/src/main.c @@ -113,7 +113,7 @@ main(gint argc, gchar *argv[]) "Connect to the session bus", NULL }, { "threads", 't', 0, G_OPTION_ARG_INT, &maxThreads, "Configure maximal number of worker threads", "N" }, - { NULL } + { 0 } }; context = g_option_context_new("Provide a D-Bus interface to a libvirtd."); -- 2.14.3

On Tue, Mar 27, 2018 at 06:44:41PM +0200, Pavel Hrdina wrote:
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/connect.c | 4 ++-- src/domain.c | 4 ++-- src/gdbus.c | 4 ++-- src/main.c | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-)
ACK Jano

clang 6.0.0 complains about unused variable if g_autoptr is used to automatically unlock mutex. Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/connect.c | 2 +- src/util.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/connect.c b/src/connect.c index c6b85ce..2350736 100644 --- a/src/connect.c +++ b/src/connect.c @@ -56,7 +56,7 @@ gboolean virtDBusConnectOpen(virtDBusConnect *connect, GError **error) { - g_autoptr(GMutexLocker) lock = g_mutex_locker_new(&connect->lock); + virtDBusUtilAutoLock lock = g_mutex_locker_new(&connect->lock); if (connect->connection) { if (virConnectIsAlive(connect->connection)) diff --git a/src/util.h b/src/util.h index a34f863..4304bac 100644 --- a/src/util.h +++ b/src/util.h @@ -6,6 +6,8 @@ #define VIRT_DBUS_ERROR virtDBusErrorQuark() +#define virtDBusUtilAutoLock g_autoptr(GMutexLocker) G_GNUC_UNUSED + typedef enum { VIRT_DBUS_ERROR_LIBVIRT, VIRT_DBUS_N_ERRORS /*< skip >*/ -- 2.14.3

On Tue, Mar 27, 2018 at 06:44:42PM +0200, Pavel Hrdina wrote:
clang 6.0.0 complains about unused variable if g_autoptr is used to
s/clang 6.0.0/Clang/ Also happens with 5.0.1 and the man page uses the Clang spelling, so you're free to capitalize it at the beginning of the sentence.
automatically unlock mutex.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/connect.c | 2 +- src/util.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-)
ACK Jano
participants (2)
-
Ján Tomko
-
Pavel Hrdina