nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit 7b1f3f4fe7c8cbfd3287365a712e2736b4cd27d2
parent 9517972b58aa49faacf7b29dbca8da5a317b2da8
Author: David Lawrence Ramsey <pooka109@gmail.com>
Date:   Sun, 18 Mar 2018 13:17:56 -0500

tweaks: correct several parameter types

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

	ISO C forbids comparison of ‘void *’ with function pointer

Diffstat:
Msrc/browser.c | 2+-
Msrc/help.c | 2+-
Msrc/nano.c | 4++--
Msrc/prompt.c | 2+-
Msrc/rcfile.c | 4++--
5 files changed, 7 insertions(+), 7 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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 @@ -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. */