From 2b21d53857c3f3f76a77c29cf5cf0c6a973731be Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Thu, 21 Mar 2019 17:36:46 +0100 Subject: [PATCH] tweaks: elide a function that is called just once --- src/chars.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/src/chars.c b/src/chars.c index a50a713d..555f804c 100644 --- a/src/chars.c +++ b/src/chars.c @@ -636,20 +636,8 @@ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer) #endif /* !NANO_TINY */ #if defined(ENABLE_NANORC) && (!defined(NANO_TINY) || defined(ENABLE_JUSTIFY)) -/* Return TRUE if the string s contains one or more blank characters, +/* Return TRUE if the given string contains at least one blank character, * and FALSE otherwise. */ -bool has_blank_chars(const char *s) -{ - for (; *s != '\0'; s++) { - if (isblank((unsigned char)*s)) - return TRUE; - } - - return FALSE; -} - -/* Return TRUE if the multibyte string s contains one or more blank - * multibyte characters, and FALSE otherwise. */ bool has_blank_mbchars(const char *s) { #ifdef ENABLE_UTF8 @@ -662,11 +650,16 @@ bool has_blank_mbchars(const char *s) if (is_blank_mbchar(symbol)) return TRUE; } - - return FALSE; } else #endif - return has_blank_chars(s); + { + for (; *s != '\0'; s++) { + if (isblank((unsigned char)*s)) + return TRUE; + } + } + + return FALSE; } #endif /* ENABLE_NANORC && (!NANO_TINY || ENABLE_JUSTIFY) */