tweaks: correct several parameter types

This avoids a bunch of warnings when compiled with -pedantic:

	ISO C forbids comparison of ‘void *’ with function pointer
master
David Lawrence Ramsey 2018-03-18 13:17:56 -05:00 committed by Benno Schulenberg
parent 9517972b58
commit 7b1f3f4fe7
5 changed files with 7 additions and 7 deletions

View File

@ -304,7 +304,7 @@ char *do_browser(char *path)
path = mallocstrcpy(path, filelist[selected]);
goto read_directory_contents;
#ifdef ENABLE_NANORC
} else if (func == (void *)implant) {
} else if (func == (functionptrtype)implant) {
implant(first_sc_for(MBROWSER, func)->expansion);
#endif
} else if (func == do_exit) {

View File

@ -217,7 +217,7 @@ void do_help(void)
} else if (func == do_findnext) {
do_findnext();
#ifdef ENABLE_NANORC
} else if (func == (void *)implant) {
} else if (func == (functionptrtype)implant) {
implant(first_sc_for(MHELP, func)->expansion);
#endif
} else if (kbinput == KEY_WINCH) {

View File

@ -1622,7 +1622,7 @@ int do_mouse(void)
#endif /* ENABLE_MOUSE */
/* Return TRUE when the given function is a cursor-moving command. */
bool wanted_to_move(void *func)
bool wanted_to_move(void (*func)(void))
{
return func == do_left || func == do_right ||
func == do_up || func == do_down ||
@ -1747,7 +1747,7 @@ int do_input(bool allow_funcs)
pletion_line = NULL;
#endif
#ifdef ENABLE_NANORC
if (shortcut->func == (void *)implant) {
if (shortcut->func == (functionptrtype)implant) {
implant(shortcut->expansion);
return 42;
}

View File

@ -153,7 +153,7 @@ int do_statusbar_input(bool *finished)
shortcut->func == do_backspace))
;
#ifdef ENABLE_NANORC
else if (shortcut->func == (void *)implant)
else if (shortcut->func == (functionptrtype)implant)
implant(shortcut->expansion);
#endif
else if (shortcut->func == do_verbatim_input)

View File

@ -413,7 +413,7 @@ void parse_binding(char *ptr, bool dobind)
* otherwise it is the name of a function. */
if (*funcptr == '"') {
newsc = nmalloc(sizeof(sc));
newsc->func = (void *)implant;
newsc->func = (functionptrtype)implant;
newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
#ifndef NANO_TINY
newsc->toggle = 0;
@ -449,7 +449,7 @@ void parse_binding(char *ptr, bool dobind)
#endif
#ifdef ENABLE_NANORC
/* Handle the special case of a key defined as a string. */
if (newsc->func == (void *)implant)
if (newsc->func == (functionptrtype)implant)
mask = MMOST | MHELP;
#endif
/* Now limit the given menu to those where the function exists. */