From 7b1f3f4fe7c8cbfd3287365a712e2736b4cd27d2 Mon Sep 17 00:00:00 2001
From: David Lawrence Ramsey <pooka109@gmail.com>
Date: Sun, 18 Mar 2018 13:17:56 -0500
Subject: [PATCH] tweaks: correct several parameter types
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

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

	ISO C forbids comparison of ‘void *’ with function pointer
---
 src/browser.c | 2 +-
 src/help.c    | 2 +-
 src/nano.c    | 4 ++--
 src/prompt.c  | 2 +-
 src/rcfile.c  | 4 ++--
 5 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/browser.c b/src/browser.c
index 2770355a..519370ed 100644
--- a/src/browser.c
+++ b/src/browser.c
@@ -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) {
diff --git a/src/help.c b/src/help.c
index a76c3a44..a0da5f97 100644
--- a/src/help.c
+++ b/src/help.c
@@ -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) {
diff --git a/src/nano.c b/src/nano.c
index 43a08348..655bf2c3 100644
--- a/src/nano.c
+++ b/src/nano.c
@@ -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;
 		}
diff --git a/src/prompt.c b/src/prompt.c
index e8fbbc0d..2c612c6e 100644
--- a/src/prompt.c
+++ b/src/prompt.c
@@ -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)
diff --git a/src/rcfile.c b/src/rcfile.c
index fda3b382..c1e6a87f 100644
--- a/src/rcfile.c
+++ b/src/rcfile.c
@@ -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. */
-- 
GitLab