Commit 7b1f3f4f authored by David Lawrence Ramsey's avatar David Lawrence Ramsey Committed by Benno Schulenberg
Browse files

tweaks: correct several parameter types

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

	ISO C forbids comparison of ‘void *’ with function pointer
No related merge requests found
Showing with 7 additions and 7 deletions
+7 -7
...@@ -304,7 +304,7 @@ char *do_browser(char *path) ...@@ -304,7 +304,7 @@ char *do_browser(char *path)
path = mallocstrcpy(path, filelist[selected]); path = mallocstrcpy(path, filelist[selected]);
goto read_directory_contents; goto read_directory_contents;
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
} else if (func == (void *)implant) { } else if (func == (functionptrtype)implant) {
implant(first_sc_for(MBROWSER, func)->expansion); implant(first_sc_for(MBROWSER, func)->expansion);
#endif #endif
} else if (func == do_exit) { } else if (func == do_exit) {
......
...@@ -217,7 +217,7 @@ void do_help(void) ...@@ -217,7 +217,7 @@ void do_help(void)
} else if (func == do_findnext) { } else if (func == do_findnext) {
do_findnext(); do_findnext();
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
} else if (func == (void *)implant) { } else if (func == (functionptrtype)implant) {
implant(first_sc_for(MHELP, func)->expansion); implant(first_sc_for(MHELP, func)->expansion);
#endif #endif
} else if (kbinput == KEY_WINCH) { } else if (kbinput == KEY_WINCH) {
......
...@@ -1622,7 +1622,7 @@ int do_mouse(void) ...@@ -1622,7 +1622,7 @@ int do_mouse(void)
#endif /* ENABLE_MOUSE */ #endif /* ENABLE_MOUSE */
/* Return TRUE when the given function is a cursor-moving command. */ /* 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 || return func == do_left || func == do_right ||
func == do_up || func == do_down || func == do_up || func == do_down ||
...@@ -1747,7 +1747,7 @@ int do_input(bool allow_funcs) ...@@ -1747,7 +1747,7 @@ int do_input(bool allow_funcs)
pletion_line = NULL; pletion_line = NULL;
#endif #endif
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
if (shortcut->func == (void *)implant) { if (shortcut->func == (functionptrtype)implant) {
implant(shortcut->expansion); implant(shortcut->expansion);
return 42; return 42;
} }
......
...@@ -153,7 +153,7 @@ int do_statusbar_input(bool *finished) ...@@ -153,7 +153,7 @@ int do_statusbar_input(bool *finished)
shortcut->func == do_backspace)) shortcut->func == do_backspace))
; ;
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
else if (shortcut->func == (void *)implant) else if (shortcut->func == (functionptrtype)implant)
implant(shortcut->expansion); implant(shortcut->expansion);
#endif #endif
else if (shortcut->func == do_verbatim_input) else if (shortcut->func == do_verbatim_input)
......
...@@ -413,7 +413,7 @@ void parse_binding(char *ptr, bool dobind) ...@@ -413,7 +413,7 @@ void parse_binding(char *ptr, bool dobind)
* otherwise it is the name of a function. */ * otherwise it is the name of a function. */
if (*funcptr == '"') { if (*funcptr == '"') {
newsc = nmalloc(sizeof(sc)); newsc = nmalloc(sizeof(sc));
newsc->func = (void *)implant; newsc->func = (functionptrtype)implant;
newsc->expansion = mallocstrcpy(NULL, funcptr + 1); newsc->expansion = mallocstrcpy(NULL, funcptr + 1);
#ifndef NANO_TINY #ifndef NANO_TINY
newsc->toggle = 0; newsc->toggle = 0;
...@@ -449,7 +449,7 @@ void parse_binding(char *ptr, bool dobind) ...@@ -449,7 +449,7 @@ void parse_binding(char *ptr, bool dobind)
#endif #endif
#ifdef ENABLE_NANORC #ifdef ENABLE_NANORC
/* Handle the special case of a key defined as a string. */ /* Handle the special case of a key defined as a string. */
if (newsc->func == (void *)implant) if (newsc->func == (functionptrtype)implant)
mask = MMOST | MHELP; mask = MMOST | MHELP;
#endif #endif
/* Now limit the given menu to those where the function exists. */ /* Now limit the given menu to those where the function exists. */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment