commit 71d0847b19a8c2a7f12d6c970bc84897e73235aa
parent c55d1447480785306796dd865443d56c0b1240c0
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Wed, 8 May 2019 15:17:04 +0200
tweaks: merge two functions, as the one is used only by the other
Diffstat:
3 files changed, 6 insertions(+), 14 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -1361,17 +1361,6 @@ void shortcut_init(void)
#endif
}
-/* Return something. */
-const funcstruct *sctofunc(const keystruct *s)
-{
- funcstruct *f = allfuncs;
-
- while (f != NULL && f->func != s->func)
- f = f->next;
-
- return f;
-}
-
#ifndef NANO_TINY
/* Return the textual description that corresponds to the given flag. */
const char *flagtostr(int flag)
diff --git a/src/nano.c b/src/nano.c
@@ -1622,9 +1622,13 @@ bool wanted_to_move(void (*func)(void))
/* Return TRUE when the given shortcut is admissible in view mode. */
bool okay_for_view(const keystruct *shortcut)
{
- const funcstruct *func = sctofunc(shortcut);
+ funcstruct *item = allfuncs;
- return (func == NULL || func->viewok);
+ /* Search the function of the given shortcut in the list of functions. */
+ while (item != NULL && item->func != shortcut->func)
+ item = item->next;
+
+ return (item == NULL || item->viewok);
}
/* Read in a keystroke. Act on the keystroke if it is a shortcut or a toggle;
diff --git a/src/proto.h b/src/proto.h
@@ -323,7 +323,6 @@ functionptrtype func_from_key(int *kbinput);
int keycode_from_string(const char *keystring);
void assign_keyinfo(keystruct *s, const char *keystring, const int keycode);
void shortcut_init(void);
-const funcstruct *sctofunc(const keystruct *s);
const char *flagtostr(int flag);
#ifdef ENABLE_NANORC
keystruct *strtosc(const char *input);