Ticket #3541: mc-3541-fix-compile-warning-regression.patch

File mc-3541-fix-compile-warning-regression.patch, 1.4 KB (added by and, 9 years ago)
  • src/editor/editcmd.c

    fix compile warning regression introduced recently
    
    editcmd.c:3647:9: error: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
    editcmd.c:3653:32: error: passing argument 1 of 'g_free' discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers]
    
    patch against 52fd328042a426e885da891c8ce8218cda3a1cf7
    compile test with GCC 5.2.0
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    
    a b  
    36013601    { 
    36023602        GArray *suggest; 
    36033603        unsigned int res; 
     3604        guint i; 
    36043605 
    36053606        suggest = g_array_new (TRUE, FALSE, sizeof (char *)); 
    36063607 
     
    36203621 
    36213622            if (retval == B_ENTER && new_word != NULL) 
    36223623            { 
    3623                 guint i; 
    36243624                char *cp_word; 
    36253625 
    36263626#ifdef HAVE_CHARSET 
     
    36443644            else if (retval == B_ADD_WORD && match_word != NULL) 
    36453645                aspell_add_to_dict (match_word->str, (int) word_len); 
    36463646        } 
    3647         guint i; 
    36483647        for (i = 0; i < suggest->len; i++) 
    36493648        { 
    3650             const char *cur_sugg_word; 
    3651             cur_sugg_word = g_array_index (suggest, const char *, i); 
     3649            char *cur_sugg_word; 
     3650            cur_sugg_word = g_array_index (suggest, char *, i); 
    36523651            if (cur_sugg_word != NULL) 
    3653                 (void) g_free (cur_sugg_word); 
     3652                g_free (cur_sugg_word); 
    36543653        } 
    36553654        g_array_free (suggest, TRUE); 
    36563655        edit->found_start = 0;