]> git.pond.sub.org Git - empserver/commit
subs/wu: Avoid "may be used uninitialized" warnings
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jan 2021 09:06:49 +0000 (10:06 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 6 Feb 2021 15:55:37 +0000 (16:55 +0100)
commite23882161e21b6e14dc9283933967d344f231954
tree5ab8c2c0903fbe3d5e40b92692888c60379975e7
parent4914daa587a25df9792013a994e5d678173fdf28
subs/wu: Avoid "may be used uninitialized" warnings

typed_wu() either sends a telegram to a single recipient @to, or an
announcement.  It initializes @np to getnatp(to) only when sending a
telegram.  It also uses it only then.  Clang is cool with this, but
GCC gets confused and warns "‘np’ may be used uninitialized".  Ron
Koenderink reports Visual Studio 2019 even flags it as an error.

Time to clean this up.  Initialize @np to NULL when sending an
announcement.  Fuse conditionals while there.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/wu.c