2016-01-04 Benno Schulenberg <bensberg@justemail.net>
* src/global.c (shortcut_init): Nowadays the functions are defined
only once, so there is no longer any need to free existing ones.
+ * src/global.c (sctofunc): Rewrite the loop, and constify the input.
2016-01-04 Mike Frysinger <vapier@gentoo.org>
* src/global.c (strtosc, strtomenu): Constify the input parameter.
}
#endif
-const subnfunc *sctofunc(sc *s)
+const subnfunc *sctofunc(const sc *s)
{
- subnfunc *f;
+ subnfunc *f = allfuncs;
- for (f = allfuncs; f != NULL && s->scfunc != f->scfunc; f = f->next)
- ;
+ while (f != NULL && f->scfunc != s->scfunc)
+ f = f->next;
return f;
}
}
if (have_shortcut) {
- const subnfunc *f = sctofunc((sc *)s);
+ const subnfunc *f = sctofunc(s);
/* If the function associated with this shortcut is
* cutting or copying text, remember this. */
if (s->scfunc == do_cut_text_void
* functions and setting finished to TRUE to indicate
* that we're done after running or trying to run their
* associated functions. */
- f = sctofunc((sc *) s);
+ f = sctofunc(s);
if (s->scfunc != NULL) {
*ran_func = TRUE;
if (f && (!ISSET(VIEW_MODE) || f->viewok) &&
void set_lint_or_format_shortcuts(void);
void set_spell_shortcuts(void);
#endif
-const subnfunc *sctofunc(sc *s);
+const subnfunc *sctofunc(const sc *s);
const char *flagtostr(int flag);
sc *strtosc(const char *input);
int strtomenu(const char *input);