diff options
author | Burt P <pburt0@gmail.com> | 2019-07-05 09:13:15 -0500 |
---|---|---|
committer | Leandro A. F. Pereira <leandro@hardinfo.org> | 2019-07-05 19:59:59 -0700 |
commit | 0173db74f803d3e11f296f272e304dceb3b639db (patch) | |
tree | cdeda1fcaee383520b03ae423ddedb8039dbaed3 | |
parent | f21e8f4857191fa22a17113c01c08a6a2b71c5aa (diff) |
shell: key_* functions use const
Signed-off-by: Burt P <pburt0@gmail.com>
-rw-r--r-- | includes/shell.h | 10 | ||||
-rw-r--r-- | shell/shell.c | 12 |
2 files changed, 11 insertions, 11 deletions
diff --git a/includes/shell.h b/includes/shell.h index c6570088..fd70b076 100644 --- a/includes/shell.h +++ b/includes/shell.h @@ -219,11 +219,11 @@ void shell_update_remote_menu(void); void shell_set_remote_label(Shell *shell, gchar *label); /* decode special information in keys */ -gboolean key_is_flagged(gchar *key); /* has $[<flags>][<tag>]$ at the start of the key */ -gboolean key_is_highlighted(gchar *key); /* flag '*' = select/highlight */ -gboolean key_wants_details(gchar *key); /* flag '!' = report should include the "moreinfo" */ -gchar *key_mi_tag(gchar *key); /* moreinfo lookup tag */ -const gchar *key_get_name(gchar *key); /* get the key's name, flagged or not */ +gboolean key_is_flagged(const gchar *key); /* has $[<flags>][<tag>]$ at the start of the key */ +gboolean key_is_highlighted(const gchar *key); /* flag '*' = select/highlight */ +gboolean key_wants_details(const gchar *key); /* flag '!' = report should include the "moreinfo" */ +gchar *key_mi_tag(const gchar *key); /* moreinfo lookup tag */ +const gchar *key_get_name(const gchar *key); /* get the key's name, flagged or not */ #endif /* __SHELL_H__ */ diff --git a/shell/shell.c b/shell/shell.c index d213344d..0307badf 100644 --- a/shell/shell.c +++ b/shell/shell.c @@ -2149,11 +2149,11 @@ static ShellTree *tree_new() return shelltree; } -gboolean key_is_flagged(gchar *key) { +gboolean key_is_flagged(const gchar *key) { return (key && *key == '$' && strchr(key+1, '$')) ? TRUE : FALSE; } -gboolean key_is_highlighted(gchar *key) { +gboolean key_is_highlighted(const gchar *key) { if (key_is_flagged(key)) { if (strchr(key, '*')) return TRUE; @@ -2161,7 +2161,7 @@ gboolean key_is_highlighted(gchar *key) { return FALSE; } -gboolean key_wants_details(gchar *key) { +gboolean key_wants_details(const gchar *key) { if (key_is_flagged(key)) { if (strchr(key, '!')) return TRUE; @@ -2169,8 +2169,8 @@ gboolean key_wants_details(gchar *key) { return FALSE; } -gchar *key_mi_tag(gchar *key) { - gchar *p = key, *l, *t; +gchar *key_mi_tag(const gchar *key) { + gchar *p = (gchar*)key, *l, *t; if (key_is_flagged(key)) { l = strchr(key+1, '$'); @@ -2186,7 +2186,7 @@ gchar *key_mi_tag(gchar *key) { return NULL; } -const gchar *key_get_name(gchar *key) { +const gchar *key_get_name(const gchar *key) { if (key_is_flagged(key)) return strchr(key+1, '$')+1; return key; |