diff options
author | Jan Alexander Steffens (heftig) <jan.steffens@gmail.com> | 2017-11-06 20:23:12 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2017-12-04 10:56:44 +0000 |
commit | d9b20492f328cd89b618de00374e6999ddf45876 (patch) | |
tree | 5da6d2e5c7823ff8dea996920c5c637f35a47080 | |
parent | 464f840a2341eef41a221e627e8db146279adda0 (diff) |
devicemonitor: Avoid maybe-uninitialized compiler warning
On Arch Linux x86_64, gcc 7.2.0-3, -Og -g3:
gstdevicemonitor.c: In function ‘bus_sync_message’:
gstdevicemonitor.c:276:8: error: ‘matches’ may be used uninitialized in this function [-Werror=maybe-uninitialized]
This commit also simplifies the code a bit.
https://bugzilla.gnome.org/show_bug.cgi?id=789983
-rw-r--r-- | gst/gstdevicemonitor.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/gst/gstdevicemonitor.c b/gst/gstdevicemonitor.c index add267ee0..49e32bb50 100644 --- a/gst/gstdevicemonitor.c +++ b/gst/gstdevicemonitor.c @@ -236,7 +236,7 @@ bus_sync_message (GstBus * bus, GstMessage * message, GstMessageType type = GST_MESSAGE_TYPE (message); if (type == GST_MESSAGE_DEVICE_ADDED || type == GST_MESSAGE_DEVICE_REMOVED) { - gboolean matches; + gboolean matches = TRUE; GstDevice *device; GstDeviceProvider *provider; @@ -250,7 +250,7 @@ bus_sync_message (GstBus * bus, GstMessage * message, GST_DEVICE_PROVIDER (gst_object_get_parent (GST_OBJECT (device))); if (is_provider_hidden (monitor, monitor->priv->hidden, provider)) { matches = FALSE; - } else if (monitor->priv->filters->len) { + } else { guint i; for (i = 0; i < monitor->priv->filters->len; i++) { @@ -265,8 +265,6 @@ bus_sync_message (GstBus * bus, GstMessage * message, if (matches) break; } - } else { - matches = TRUE; } GST_OBJECT_UNLOCK (monitor); |