Ticket #3547: mc-3547-cleanup-Wconditional-uninitialized-warning.patch

File mc-3547-cleanup-Wconditional-uninitialized-warning.patch, 1.8 KB (added by and, 8 years ago)
  • src/editor/editcmd.c

    From 90a369768322d0e085f5260be2c039ecdb8c41ec Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sat, 27 Feb 2016 23:31:24 +0000
    Subject: [PATCH] cleanup -Wconditional-uninitialized warning
    
    editcmd.c:2372:53: error: variable 'mark2' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            edit_set_markers (edit, edit->buffer.curs1, mark2, c1, c2);
                                                        ^~~~~
    editcmd.c:2334:23: note: initialize the variable 'mark2' to silence this warning
        off_t mark1, mark2;
                          ^
                           = 0
    editcmd.c:2372:60: error: variable 'c1' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            edit_set_markers (edit, edit->buffer.curs1, mark2, c1, c2);
                                                               ^~
    editcmd.c:2335:12: note: initialize the variable 'c1' to silence this warning
        long c1, c2;
               ^
                = 0
    editcmd.c:2372:64: error: variable 'c2' may be uninitialized when used here [-Werror,-Wconditional-uninitialized]
            edit_set_markers (edit, edit->buffer.curs1, mark2, c1, c2);
                                                                   ^~
    editcmd.c:2335:16: note: initialize the variable 'c2' to silence this warning
        long c1, c2;
                   ^
                    = 0
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/editor/editcmd.c | 4 ++--
     1 file changed, 2 insertions(+), 2 deletions(-)
    
    diff --git a/src/editor/editcmd.c b/src/editor/editcmd.c
    index 0d2d6e1..a962e39 100644
    a b void 
    23312331edit_block_copy_cmd (WEdit * edit) 
    23322332{ 
    23332333    off_t start_mark, end_mark, current = edit->buffer.curs1; 
    2334     off_t mark1, mark2; 
    2335     long c1, c2; 
     2334    off_t mark1, mark2 = 0; 
     2335    long c1 = 0, c2 = 0; 
    23362336    off_t size; 
    23372337    unsigned char *copy_buf; 
    23382338