Ticket #3547: mc-3547-cleanup-usermenu.c-use-const-edit_widget.patch

File mc-3547-cleanup-usermenu.c-use-const-edit_widget.patch, 3.6 KB (added by and, 6 years ago)
  • src/filemanager/usermenu.c

    From e406967e122728211058cc7e81779cddc31c21ac Mon Sep 17 00:00:00 2001
    From: Andreas Mohr <and@gmx.li>
    Date: Sun, 17 Jan 2016 15:32:22 +0000
    Subject: [PATCH] cleanup: usermenu.c use const edit_widget
    
    use const because edit_widget not altered in these functions
    
    Signed-off-by: Andreas Mohr <and@gmx.li>
    ---
     src/filemanager/usermenu.c         | 10 +++++-----
     src/filemanager/usermenu.h         |  4 ++--
     tests/src/filemanager/examine_cd.c |  2 +-
     3 files changed, 8 insertions(+), 8 deletions(-)
    
    diff --git a/src/filemanager/usermenu.c b/src/filemanager/usermenu.c
    index 16e0c5d..5ba3917 100644
    a b test_type (WPanel * panel, char *arg) 
    214214   p. Returns the point after condition. */ 
    215215 
    216216static char * 
    217 test_condition (WEdit * edit_widget, char *p, gboolean * condition) 
     217test_condition (const WEdit * edit_widget, char *p, gboolean * condition) 
    218218{ 
    219219    char arg[256]; 
    220220    const mc_search_type_t search_type = easy_patterns ? MC_SEARCH_T_GLOB : MC_SEARCH_T_REGEX; 
    debug_out (char *start, char *end, gboolean condition) 
    356356   the point just before the end of line. */ 
    357357 
    358358static char * 
    359 test_line (WEdit * edit_widget, char *p, gboolean * result) 
     359test_line (const WEdit * edit_widget, char *p, gboolean * result) 
    360360{ 
    361361    char operator; 
    362362 
    test_line (WEdit * edit_widget, char *p, gboolean * result) 
    422422/** FIXME: recode this routine on version 3.0, it could be cleaner */ 
    423423 
    424424static void 
    425 execute_menu_command (WEdit * edit_widget, const char *commands, gboolean show_prompt) 
     425execute_menu_command (const WEdit * edit_widget, const char *commands, gboolean show_prompt) 
    426426{ 
    427427    FILE *cmd_file; 
    428428    int cmd_file_fd; 
    check_format_var (const char *p, char **v) 
    729729/* --------------------------------------------------------------------------------------------- */ 
    730730 
    731731char * 
    732 expand_format (struct WEdit *edit_widget, char c, gboolean do_quote) 
     732expand_format (const struct WEdit *edit_widget, char c, gboolean do_quote) 
    733733{ 
    734734    WPanel *panel = NULL; 
    735735    char *(*quote_func) (const char *, gboolean); 
    expand_format (struct WEdit *edit_widget, char c, gboolean do_quote) 
    916916 */ 
    917917 
    918918gboolean 
    919 user_menu_cmd (struct WEdit * edit_widget, const char *menu_file, int selected_entry) 
     919user_menu_cmd (const struct WEdit * edit_widget, const char *menu_file, int selected_entry) 
    920920{ 
    921921    char *p; 
    922922    char *data, **entries; 
  • src/filemanager/usermenu.h

    diff --git a/src/filemanager/usermenu.h b/src/filemanager/usermenu.h
    index c3676e0..cd3afdf 100644
    a b struct WEdit; 
    1919 
    2020/*** declarations of public functions ************************************************************/ 
    2121 
    22 gboolean user_menu_cmd (struct WEdit *edit_widget, const char *menu_file, int selected_entry); 
    23 char *expand_format (struct WEdit *edit_widget, char c, gboolean do_quote); 
     22gboolean user_menu_cmd (const struct WEdit *edit_widget, const char *menu_file, int selected_entry); 
     23char *expand_format (const struct WEdit *edit_widget, char c, gboolean do_quote); 
    2424int check_format_view (const char *); 
    2525int check_format_var (const char *, char **); 
    2626int check_format_cd (const char *); 
  • tests/src/filemanager/examine_cd.c

    diff --git a/tests/src/filemanager/examine_cd.c b/tests/src/filemanager/examine_cd.c
    index b087a91..549e54b 100644
    a b quiet_quit_cmd (void) 
    7171} 
    7272 
    7373char * 
    74 expand_format (struct WEdit *edit_widget, char c, gboolean do_quote) 
     74expand_format (const struct WEdit *edit_widget, char c, gboolean do_quote) 
    7575{ 
    7676    (void) edit_widget; 
    7777    (void) c;