tweaks: merge two functions, as the one is used only by the other

master
Benno Schulenberg 2019-05-08 15:17:04 +02:00
parent c55d144748
commit 71d0847b19
3 changed files with 6 additions and 14 deletions

View File

@ -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)

View File

@ -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;

View File

@ -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);