fix 2 false-positive warnings with gcc 10.2+ and -Wall -O2 - sfeed_curses - sfeed curses UI (now part of sfeed, development is in sfeed)
(HTM) git clone git://git.codemadness.org/sfeed_curses
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 61c48746013c47d77b47c0b7606882983b185b6d
(DIR) parent f0a76e0f90e04147b1199a9187c97c4727d240c4
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Wed, 7 Apr 2021 20:29:28 +0200
fix 2 false-positive warnings with gcc 10.2+ and -Wall -O2
These conditions cannot happen though.
Noticed in the package for Oasis Linux:
https://github.com/oasislinux/oasis/blob/master/pkg/sfeed_curses/gen.lua
Thanks Michael Forney.
Diffstat:
M sfeed_curses.c | 20 ++++++--------------
1 file changed, 6 insertions(+), 14 deletions(-)
---
(DIR) diff --git a/sfeed_curses.c b/sfeed_curses.c
@@ -1483,7 +1483,7 @@ void
feeds_reloadall(void)
{
struct pane *p;
- struct feed *f;
+ struct feed *f = NULL;
struct row *row;
off_t pos;
@@ -1502,7 +1502,7 @@ feeds_reloadall(void)
updatetitle();
/* try to find the same feed in the pane */
- if (row && f && (pos = feeds_row_get(p, f)) != -1)
+ if (f && (pos = feeds_row_get(p, f)) != -1)
pane_setpos(p, pos);
else
pane_setpos(p, 0);
@@ -1644,7 +1644,7 @@ updatesidebar(void)
struct row *row;
struct feed *feed;
size_t i, nrows;
- int oldvalue, newvalue;
+ int oldvalue = 0, newvalue = 0;
p = &panes[PaneFeeds];
if (!p->rows)
@@ -1678,18 +1678,10 @@ updatesidebar(void)
}
p->nrows = nrows;
- switch (layout) {
- case LayoutVertical:
- case LayoutHorizontal:
- if (oldvalue != newvalue)
- updategeom();
- else
- p->dirty = 1;
- break;
- default:
+ if (oldvalue != newvalue)
+ updategeom();
+ else
p->dirty = 1;
- break;
- }
if (!p->nrows)
p->pos = 0;