From ad778b7dc107ddc851fdb9e249ca2aa340766d93 Mon Sep 17 00:00:00 2001 From: Dave Davenport Date: Mon, 23 Nov 2015 21:52:55 +0100 Subject: [PATCH] Const making. --- include/rofi.h | 2 +- source/dialogs/combi.c | 4 ++-- source/dialogs/dmenu.c | 4 ++-- source/dialogs/drun.c | 4 ++-- source/dialogs/run.c | 4 ++-- source/dialogs/script.c | 4 ++-- source/dialogs/ssh.c | 4 ++-- source/dialogs/window.c | 4 ++-- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/include/rofi.h b/include/rofi.h index 81230f4b..2cf0d6d7 100644 --- a/include/rofi.h +++ b/include/rofi.h @@ -288,7 +288,7 @@ struct _Switcher * A switcher normally consists of the following parts: */ void ( *init )( struct _Switcher *sw ); - unsigned int ( *get_num_entries )( struct _Switcher *sw ); + unsigned int ( *get_num_entries )( const struct _Switcher *sw ); int ( *match )( char **tokens, const char *input, int case_sensitive, int index, struct _Switcher *data ); SwitcherMode ( *result )( int menu_retv, char **input, unsigned int selected_line, struct _Switcher *pd ); void ( *destroy )( struct _Switcher *pd ); diff --git a/source/dialogs/combi.c b/source/dialogs/combi.c index 0bdc7d87..ef050043 100644 --- a/source/dialogs/combi.c +++ b/source/dialogs/combi.c @@ -120,9 +120,9 @@ static void combi_mode_init ( Switcher *sw ) } } } -static unsigned int combi_mode_get_num_entries ( Switcher *sw ) +static unsigned int combi_mode_get_num_entries ( const Switcher *sw ) { - CombiModePrivateData *pd = sw->private_data; + const CombiModePrivateData *pd = (const CombiModePrivateData *)sw->private_data; return pd->cmd_list_length; } static void combi_mode_destroy ( Switcher *sw ) diff --git a/source/dialogs/dmenu.c b/source/dialogs/dmenu.c index 67562dbd..50b7750b 100644 --- a/source/dialogs/dmenu.c +++ b/source/dialogs/dmenu.c @@ -96,9 +96,9 @@ static char **get_dmenu ( unsigned int *length ) return retv; } -static unsigned int dmenu_mode_get_num_entries ( Switcher *sw ) +static unsigned int dmenu_mode_get_num_entries ( const Switcher *sw ) { - DmenuModePrivateData *rmpd = (DmenuModePrivateData *) sw->private_data; + const DmenuModePrivateData *rmpd = (const DmenuModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } diff --git a/source/dialogs/drun.c b/source/dialogs/drun.c index f32eb5b9..52bf9812 100644 --- a/source/dialogs/drun.c +++ b/source/dialogs/drun.c @@ -317,9 +317,9 @@ static int drun_token_match ( char **tokens, return 0; } -static unsigned int drun_mode_get_num_entries ( Switcher *sw ) +static unsigned int drun_mode_get_num_entries ( const Switcher *sw ) { - DRunModePrivateData *pd = (DRunModePrivateData *) sw->private_data; + const DRunModePrivateData *pd = (const DRunModePrivateData *) sw->private_data; return pd->cmd_list_length; } static int drun_is_not_ascii ( const Switcher *sw, unsigned int index ) diff --git a/source/dialogs/run.c b/source/dialogs/run.c index e1a5e3a4..29af9611 100644 --- a/source/dialogs/run.c +++ b/source/dialogs/run.c @@ -276,9 +276,9 @@ static void run_mode_init ( Switcher *sw ) } } -static unsigned int run_mode_get_num_entries ( Switcher *sw ) +static unsigned int run_mode_get_num_entries ( const Switcher *sw ) { - RunModePrivateData *rmpd = (RunModePrivateData *) sw->private_data; + const RunModePrivateData *rmpd = (const RunModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } diff --git a/source/dialogs/script.c b/source/dialogs/script.c index ea586258..a1e52e75 100644 --- a/source/dialogs/script.c +++ b/source/dialogs/script.c @@ -105,9 +105,9 @@ static void script_mode_init ( Switcher *sw ) pd->cmd_list = get_script_output ( (const char *) sw->ed, &( pd->cmd_list_length ) ); } } -static unsigned int script_mode_get_num_entries ( Switcher *sw ) +static unsigned int script_mode_get_num_entries ( const Switcher *sw ) { - ScriptModePrivateData *rmpd = (ScriptModePrivateData *) sw->private_data; + const ScriptModePrivateData *rmpd = (const ScriptModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } diff --git a/source/dialogs/ssh.c b/source/dialogs/ssh.c index 2920480d..590c1f54 100644 --- a/source/dialogs/ssh.c +++ b/source/dialogs/ssh.c @@ -331,9 +331,9 @@ static void ssh_mode_init ( Switcher *sw ) } } -static unsigned int ssh_mode_get_num_entries ( Switcher *sw ) +static unsigned int ssh_mode_get_num_entries ( const Switcher *sw ) { - SSHModePrivateData *rmpd = (SSHModePrivateData *) sw->private_data; + const SSHModePrivateData *rmpd = (const SSHModePrivateData *) sw->private_data; return rmpd->cmd_list_length; } static SwitcherMode ssh_mode_result ( int mretv, char **input, unsigned int selected_line, diff --git a/source/dialogs/window.c b/source/dialogs/window.c index 75346919..6c90c723 100644 --- a/source/dialogs/window.c +++ b/source/dialogs/window.c @@ -365,9 +365,9 @@ static int window_match ( char **tokens, return match; } -static unsigned int window_mode_get_num_entries ( Switcher *sw ) +static unsigned int window_mode_get_num_entries ( const Switcher *sw ) { - SwitcherModePrivateData *pd = (SwitcherModePrivateData *) sw->private_data; + const SwitcherModePrivateData *pd = (const SwitcherModePrivateData *) sw->private_data; return pd->cmd_list_length; } static void _window_mode_load_data ( Switcher *sw, unsigned int cd )