foxygit / doom Log in
commit 75c479943f4eb0199150b3a46e838f203863ec58
Author:     Fabian Greffrath <fabian@greffrath.com>
AuthorDate: Tue May 5 12:24:19 2015 +0200
Commit:     Fabian Greffrath <fabian@greffrath.com>
CommitDate: Tue May 5 12:24:19 2015 +0200

    warnings: fix "address of array .. will always evaluate to 'true'"

    Remove a redundant check from an ORer condition. Unlike in Doom, in
    Hexen the player->message element is not a pointer, but a char[80]
    array. Its address will never be NULL and thus will never get
    interpreted as "false". Hence, the check for "!player->message" will
    never be "true" and a check for "|| false)" is a no-op.

    Thanks to @edward-san for finding this with clang-3.6!
---
 src/hexen/h2_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/hexen/h2_main.c b/src/hexen/h2_main.c
index 1786a1fb..01ba726c 100644
--- a/src/hexen/h2_main.c
+++ b/src/hexen/h2_main.c
@@ -855,7 +855,7 @@ static void DrawMessage(void)
     player_t *player;

     player = &players[consoleplayer];
-    if (player->messageTics <= 0 || !player->message)
+    if (player->messageTics <= 0)
     {                           // No message
         return;
     }