[PATCH weston v2 3/8] terminal: Silence maybe-uninitialized warning

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Jul 10 09:00:52 UTC 2016


From: Quentin Glidic <sardemff7+git at sardemff7.net>

clients/terminal.c: In function 'recompute_selection':
clients/terminal.c:2676:22: warning: 'data' may be used uninitialized in
this function [-Wmaybe-uninitialized]
   if (col > 0 && data[col - 1].ch == 0)
                         ^

Warning produced by GCC 5.3 and 6.1, with -Og.

Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---

I am not 100% sure about this one, should we check the value?

 clients/terminal.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/clients/terminal.c b/clients/terminal.c
index 6257cb7..100ef3c 100644
--- a/clients/terminal.c
+++ b/clients/terminal.c
@@ -2596,7 +2596,7 @@ recompute_selection(struct terminal *terminal)
 	int side_margin, top_margin;
 	int start_x, end_x;
 	int cw, ch;
-	union utf8_char *data;
+	union utf8_char *data = NULL;
 
 	cw = terminal->average_width;
 	ch = terminal->extents.height;
-- 
2.9.0



More information about the wayland-devel mailing list