[glib: 2/9] gmain: Initialise a variable
- From: Sebastian Dröge <sdroege src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 2/9] gmain: Initialise a variable
- Date: Thu, 28 Apr 2022 11:07:36 +0000 (UTC)
commit 86b8891add744d59552e9fc72dd648d5197a9757
Author: Philip Withnall <pwithnall endlessos org>
Date: Thu Apr 28 10:40:38 2022 +0100
gmain: Initialise a variable
This fixes a scan-build warning:
```
../../../../source/glib/glib/gmain.c:4193:18: warning: 2nd function call argument is an uninitialized
value [core.CallAndMessage]
while ((nfds = g_main_context_query (context, max_priority, &timeout, fds,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```
This is a valid situation which can occur if the preceding
`g_main_context_prepare()` call returns `FALSE` and doesn’t set
`max_priority`.
Signed-off-by: Philip Withnall <pwithnall endlessos org>
Helps: #1767
glib/gmain.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glib/gmain.c b/glib/gmain.c
index 94aa1152a6..4c1403a955 100644
--- a/glib/gmain.c
+++ b/glib/gmain.c
@@ -4147,7 +4147,7 @@ g_main_context_iterate (GMainContext *context,
gboolean dispatch,
GThread *self)
{
- gint max_priority;
+ gint max_priority = 0;
gint timeout;
gboolean some_ready;
gint nfds, allocated_nfds;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]