nano

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

commit c8b26baee806ce2d7d523c4501020b26012edb82
parent bb394990cd2570ff9aec4394f40df06a39db778c
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 13 Apr 2018 10:17:08 +0200

tweaks: elide a function that is called just once

Also adjust and correct a comment.

Diffstat:
Msrc/search.c | 21++++++---------------
1 file changed, 6 insertions(+), 15 deletions(-)

diff --git a/src/search.c b/src/search.c @@ -55,16 +55,6 @@ bool regexp_init(const char *regexp) return TRUE; } -/* Decompile the compiled regular expression we used in the last - * search, if any. */ -void regexp_cleanup(void) -{ - if (regexp_compiled) { - regexp_compiled = FALSE; - regfree(&search_regexp); - } -} - /* Report on the status bar that the given string was not found. */ void not_found_msg(const char *str) { @@ -76,17 +66,18 @@ void not_found_msg(const char *str) free(disp); } -/* Abort the current search or replace. Clean up by displaying the main - * shortcut list, updating the screen if the mark was on before, and - * decompiling the compiled regular expression we used in the last - * search, if any. */ +/* Free a compiled regular expression, if one was compiled; and schedule a + * full screen refresh when the mark is on, in case the cursor has moved. */ void search_replace_abort(void) { + if (regexp_compiled) { + regexp_compiled = FALSE; + regfree(&search_regexp); + } #ifndef NANO_TINY if (openfile->mark) refresh_needed = TRUE; #endif - regexp_cleanup(); } /* Prepare the prompt and ask the user what to search for. Keep looping