Ticket #3693: mc-3693-editcmd_dialogs.c-Cleanup-maybe-uninitialized-compil.patch

File mc-3693-editcmd_dialogs.c-Cleanup-maybe-uninitialized-compil.patch, 1.6 KB (added by and, 8 years ago)
  • src/editor/editcmd_dialogs.c

    From a11223c5ced0de7ce1e05ce06741496ea68fece1 Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Tue, 6 Dec 2016 10:05:47 +0000
    Subject: [PATCH] (editcmd_dialogs.c) Cleanup maybe-uninitialized compiler warning
    
    Found by GCC 6.2.0.
    
    editcmd_dialogs.c: In function 'editcmd_dialog_replace_show':
    editcmd_dialogs.c:200:24: error: 'num_of_types' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    editcmd_dialogs.c:191:12: note: 'num_of_types' was declared here
    
    editcmd_dialogs.c: In function 'editcmd_dialog_search_show':
    editcmd_dialogs.c:102:24: error: 'num_of_types' may be used uninitialized in this function [-Werror=maybe-uninitialized]
    editcmd_dialogs.c:95:12: note: 'num_of_types' was declared here
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/editcmd_dialogs.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/editor/editcmd_dialogs.c b/src/editor/editcmd_dialogs.c
    index 007e69a..6eefb72 100644
    a b gboolean 
    9292editcmd_dialog_search_show (WEdit * edit) 
    9393{ 
    9494    char *search_text; 
    95     size_t num_of_types; 
     95    size_t num_of_types = 0; 
    9696    gchar **list_of_types; 
    9797    int dialog_result; 
    9898 
    void 
    188188editcmd_dialog_replace_show (WEdit * edit, const char *search_default, const char *replace_default, 
    189189                             /*@out@ */ char **search_text, /*@out@ */ char **replace_text) 
    190190{ 
    191     size_t num_of_types; 
     191    size_t num_of_types = 0; 
    192192    gchar **list_of_types; 
    193193 
    194194    if ((search_default == NULL) || (*search_default == '\0'))