From ba2e6f43c284770eac121eb418c43414e8fde953 Mon Sep 17 00:00:00 2001 From: Benno Schulenberg Date: Sun, 3 Jun 2018 17:47:02 +0200 Subject: [PATCH] tweaks: elide a subfunction that is used just once (Forgot to say: the previous two commits addressed https://savannah.gnu.org/bugs/?54044.) --- src/chars.c | 8 ++------ src/proto.h | 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/chars.c b/src/chars.c index 80ac550a..7fc3e82b 100644 --- a/src/chars.c +++ b/src/chars.c @@ -530,15 +530,11 @@ char *mbrevstrcasestr(const char *haystack, const char *needle, return revstrcasestr(haystack, needle, pointer); } -/* This function is equivalent to strlen() for multibyte strings. */ +/* Count the number of (multibyte) characters in the given string. */ size_t mbstrlen(const char *s) { - return mbstrnlen(s, (size_t)-1); -} + size_t maxlen = (size_t)-1; -/* This function is equivalent to strnlen() for multibyte strings. */ -size_t mbstrnlen(const char *s, size_t maxlen) -{ #ifdef ENABLE_UTF8 if (use_utf8) { size_t n = 0; diff --git a/src/proto.h b/src/proto.h index afe6a437..399725a8 100644 --- a/src/proto.h +++ b/src/proto.h @@ -222,7 +222,6 @@ char *mbstrcasestr(const char *haystack, const char *needle); char *revstrstr(const char *haystack, const char *needle, const char *index); char *mbrevstrcasestr(const char *haystack, const char *needle, const char *index); size_t mbstrlen(const char *s); -size_t mbstrnlen(const char *s, size_t maxlen); #if !defined(NANO_TINY) || defined(ENABLE_JUSTIFY) char *mbstrchr(const char *s, const char *c); #endif