Ticket #3693: mc-3693-editcmd.c-Cleanup-comma-compiler-warning.patch

File mc-3693-editcmd.c-Cleanup-comma-compiler-warning.patch, 1.5 KB (added by and, 6 years ago)
  • src/editor/editcmd.c

    From 183ba9d6feb31e45b566ff940754ce7d94c4f0eb Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Tue, 6 Dec 2016 11:05:53 +0000
    Subject: [PATCH] (editcmd.c) Cleanup comma compiler warning
    
    Found by Clang 3.9.0.
    
    editcmd.c:2556:24: error: possible misuse of comma operator here [-Werror,-Wcomma]
            g_free (saved1), saved1 = g_strdup (input1);
                           ^
    editcmd.c:2556:9: note: cast expression to void to silence warning
            g_free (saved1), saved1 = g_strdup (input1);
            ^~~~~~~~~~~~~~~
    
    editcmd.c:2557:24: error: possible misuse of comma operator here [-Werror,-Wcomma]
            g_free (saved2), saved2 = g_strdup (input2);
                           ^
    editcmd.c:2557:9: note: cast expression to void to silence warning
            g_free (saved2), saved2 = g_strdup (input2);
            ^~~~~~~~~~~~~~~
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/editcmd.c | 6 ++++--
     1 file changed, 4 insertions(+), 2 deletions(-)
    
    diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
    index 6cf3f82..a4586c7 100644
    a b edit_replace_cmd (WEdit * edit, gboolean again) 
    25532553        g_free (tmp_inp1); 
    25542554        g_free (tmp_inp2); 
    25552555 
    2556         g_free (saved1), saved1 = g_strdup (input1); 
    2557         g_free (saved2), saved2 = g_strdup (input2); 
     2556        g_free (saved1); 
     2557        saved1 = g_strdup (input1); 
     2558        g_free (saved2); 
     2559        saved2 = g_strdup (input2); 
    25582560 
    25592561        mc_search_free (edit->search); 
    25602562        edit->search = NULL;