From 36092f3a0cf12bfdeac777eb139314ca2deb6236 Mon Sep 17 00:00:00 2001 From: Eliseo Martínez Date: Wed, 25 Feb 2015 22:37:38 +0100 Subject: Fix warnings: message.c: copy_hotkeys_and_msg: Garbage value: FP. #2062 Problem : Branch condition evaluates to a garbage value @ 2868. Diagnostic : False positive. Rationale : Array has_hotkey, declared at 2812, is initialized by console_dialog_alloc (only the needed number of elements). That same number of elements is used by copy_hotkeys_and_msg. Suggested path error is impossible, because it involves a different number of elements in those functions. Resolution : Above condition is cumbersome to prove through assertions. Thus, we prefer to just initialize the array to all-false at declaration point before calling console_dialog_alloc. --- src/nvim/message.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/message.c') diff --git a/src/nvim/message.c b/src/nvim/message.c index 24cb727802..27619fcc5d 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -2809,7 +2809,7 @@ static char_u * console_dialog_alloc(const char_u *message, static char_u *msg_show_console_dialog(char_u *message, char_u *buttons, int dfltbutton) FUNC_ATTR_NONNULL_RET { - bool has_hotkey[HAS_HOTKEY_LEN]; + bool has_hotkey[HAS_HOTKEY_LEN] = {false}; char_u *hotk = console_dialog_alloc(message, buttons, has_hotkey); copy_hotkeys_and_msg(message, buttons, dfltbutton, has_hotkey, hotk); -- cgit