mirror of
https://github.com/rkd77/elinks.git
synced 2025-01-03 14:57:44 -05:00
Key name strings are const in read_key() and in its (indirect) callers.
This commit is contained in:
parent
aba0bc77a8
commit
2eeb14f95c
@ -206,7 +206,7 @@ kbd_nm_lookup(enum keymap_id keymap_id, unsigned char *name)
|
||||
}
|
||||
|
||||
static struct keybinding *
|
||||
kbd_stroke_lookup(enum keymap_id keymap_id, unsigned char *keystroke_str)
|
||||
kbd_stroke_lookup(enum keymap_id keymap_id, const unsigned char *keystroke_str)
|
||||
{
|
||||
struct term_event_keyboard kbd;
|
||||
|
||||
@ -230,7 +230,7 @@ static struct keymap keymap_table[] = {
|
||||
|
||||
static struct action *
|
||||
get_action_from_keystroke(enum keymap_id keymap_id,
|
||||
unsigned char *keystroke_str)
|
||||
const unsigned char *keystroke_str)
|
||||
{
|
||||
struct keybinding *keybinding = kbd_stroke_lookup(keymap_id,
|
||||
keystroke_str);
|
||||
@ -240,7 +240,7 @@ get_action_from_keystroke(enum keymap_id keymap_id,
|
||||
|
||||
unsigned char *
|
||||
get_action_name_from_keystroke(enum keymap_id keymap_id,
|
||||
unsigned char *keystroke_str)
|
||||
const unsigned char *keystroke_str)
|
||||
{
|
||||
struct action *action = get_action_from_keystroke(keymap_id,
|
||||
keystroke_str);
|
||||
@ -355,7 +355,7 @@ static struct key key_table[] = {
|
||||
};
|
||||
|
||||
term_event_key_T
|
||||
read_key(unsigned char *key_str)
|
||||
read_key(const unsigned char *key_str)
|
||||
{
|
||||
struct key *key;
|
||||
|
||||
@ -370,7 +370,7 @@ read_key(unsigned char *key_str)
|
||||
}
|
||||
|
||||
int
|
||||
parse_keystroke(unsigned char *s, struct term_event_keyboard *kbd)
|
||||
parse_keystroke(const unsigned char *s, struct term_event_keyboard *kbd)
|
||||
{
|
||||
unsigned char ctrlbuf[2];
|
||||
|
||||
@ -550,7 +550,7 @@ free_keymaps(struct module *xxx)
|
||||
|
||||
#ifdef CONFIG_SCRIPTING
|
||||
static unsigned char *
|
||||
bind_key_to_event(unsigned char *ckmap, unsigned char *ckey, int event)
|
||||
bind_key_to_event(unsigned char *ckmap, const unsigned char *ckey, int event)
|
||||
{
|
||||
struct term_event_keyboard kbd;
|
||||
action_id_T action_id;
|
||||
@ -572,7 +572,7 @@ bind_key_to_event(unsigned char *ckmap, unsigned char *ckey, int event)
|
||||
}
|
||||
|
||||
int
|
||||
bind_key_to_event_name(unsigned char *ckmap, unsigned char *ckey,
|
||||
bind_key_to_event_name(unsigned char *ckmap, const unsigned char *ckey,
|
||||
unsigned char *event_name, unsigned char **err)
|
||||
{
|
||||
int event_id;
|
||||
@ -867,7 +867,7 @@ get_aliased_action(enum keymap_id keymap_id, unsigned char *action_str)
|
||||
|
||||
/* Return 0 when ok, something strange otherwise. */
|
||||
int
|
||||
bind_do(unsigned char *keymap_str, unsigned char *keystroke_str,
|
||||
bind_do(unsigned char *keymap_str, const unsigned char *keystroke_str,
|
||||
unsigned char *action_str, int is_system_conf)
|
||||
{
|
||||
enum keymap_id keymap_id;
|
||||
@ -891,7 +891,7 @@ bind_do(unsigned char *keymap_str, unsigned char *keystroke_str,
|
||||
}
|
||||
|
||||
unsigned char *
|
||||
bind_act(unsigned char *keymap_str, unsigned char *keystroke_str)
|
||||
bind_act(unsigned char *keymap_str, const unsigned char *keystroke_str)
|
||||
{
|
||||
enum keymap_id keymap_id;
|
||||
unsigned char *action;
|
||||
|
@ -123,7 +123,7 @@ struct action *get_action(enum keymap_id keymap_id, action_id_T action_id);
|
||||
unsigned char *get_action_name(enum keymap_id keymap_id, action_id_T action_id);
|
||||
action_id_T get_action_from_string(enum keymap_id keymap_id, unsigned char *str);
|
||||
unsigned char *get_action_name_from_keystroke(enum keymap_id keymap_id,
|
||||
unsigned char *keystroke_str);
|
||||
const unsigned char *keystroke_str);
|
||||
|
||||
static inline unsigned int
|
||||
action_is_anonymous_safe(enum keymap_id keymap_id, action_id_T action_id)
|
||||
@ -173,10 +173,10 @@ action_requires_form(enum keymap_id keymap_id, action_id_T action_id)
|
||||
return action && (action->flags & ACTION_REQUIRE_FORM);
|
||||
}
|
||||
|
||||
term_event_key_T read_key(unsigned char *);
|
||||
term_event_key_T read_key(const unsigned char *);
|
||||
unsigned char *get_keymap_name(enum keymap_id);
|
||||
|
||||
int parse_keystroke(unsigned char *, struct term_event_keyboard *);
|
||||
int parse_keystroke(const unsigned char *, struct term_event_keyboard *);
|
||||
void add_keystroke_to_string(struct string *str, struct term_event_keyboard *kbd, int escape);
|
||||
|
||||
/* void add_accesskey_to_string(struct string *str, unicode_val_T accesskey); */
|
||||
@ -195,12 +195,12 @@ action_id_T kbd_action(enum keymap_id, struct term_event *, int *);
|
||||
struct keybinding *kbd_ev_lookup(enum keymap_id, struct term_event_keyboard *kbd, int *);
|
||||
struct keybinding *kbd_nm_lookup(enum keymap_id, unsigned char *);
|
||||
|
||||
int bind_do(unsigned char *, unsigned char *, unsigned char *, int);
|
||||
unsigned char *bind_act(unsigned char *, unsigned char *);
|
||||
int bind_do(unsigned char *, const unsigned char *, unsigned char *, int);
|
||||
unsigned char *bind_act(unsigned char *, const unsigned char *);
|
||||
void bind_config_string(struct string *);
|
||||
|
||||
#ifdef CONFIG_SCRIPTING
|
||||
int bind_key_to_event_name(unsigned char *, unsigned char *, unsigned char *,
|
||||
int bind_key_to_event_name(unsigned char *, const unsigned char *, unsigned char *,
|
||||
unsigned char **);
|
||||
#endif
|
||||
|
||||
|
@ -289,7 +289,7 @@ l_bind_key(LS)
|
||||
add_format_to_string(&event_name, "lua-run-func %i", ref);
|
||||
|
||||
event_id = bind_key_to_event_name((unsigned char *) lua_tostring(S, 1),
|
||||
(unsigned char *) lua_tostring(S, 2),
|
||||
(const unsigned char *) lua_tostring(S, 2),
|
||||
event_name.source, &err);
|
||||
done_string(&event_name);
|
||||
|
||||
|
@ -17,7 +17,7 @@ static JSBool
|
||||
keymap_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
{
|
||||
unsigned char *action_str;
|
||||
unsigned char *keystroke_str;
|
||||
const unsigned char *keystroke_str;
|
||||
int *data = JS_GetPrivate(ctx, obj);
|
||||
enum keymap_id keymap_id = *data;
|
||||
|
||||
@ -64,7 +64,7 @@ keymap_set_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
int *data = JS_GetPrivate(ctx, obj);
|
||||
enum keymap_id keymap_id = *data;
|
||||
unsigned char *keymap_str;
|
||||
unsigned char *keystroke_str;
|
||||
const unsigned char *keystroke_str;
|
||||
|
||||
/* Ugly fact: we need to get the string from the id to give to bind_do,
|
||||
* which will of course then convert the string back to an id... */
|
||||
|
Loading…
Reference in New Issue
Block a user