[libglnx: 1/2] console: Pacify `gcc -fanalyzer`
- From: Colin Walters <walters src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libglnx: 1/2] console: Pacify `gcc -fanalyzer`
- Date: Mon, 28 Jun 2021 15:02:43 +0000 (UTC)
commit 62f8ed6c8ef489201a19f1e28656c58b363ba851
Author: Colin Walters <walters verbum org>
Date: Mon Jun 28 10:05:09 2021 -0400
console: Pacify `gcc -fanalyzer`
It's not smart enough to follow the conditionals here to see
that `textlen > 0` implies `text != NULL`. But the cost of an additional
check is probably nil, so let's be robust to future code refactoring.
glnx-console.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/glnx-console.c b/glnx-console.c
index c2fe29d..0a96cdc 100644
--- a/glnx-console.c
+++ b/glnx-console.c
@@ -261,7 +261,7 @@ text_percent_internal (const char *text,
const guint textlen = MIN (input_textlen, ncolumns - bar_min);
const guint barlen = MIN (MAX_PROGRESSBAR_COLUMNS, ncolumns - (textlen + 1));
- if (textlen > 0)
+ if (text && textlen > 0)
{
fwrite (text, 1, textlen, stdout);
fputc (' ', stdout);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]