nano

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

commit 55952c0984feeaa9d933079b6f70031091033a0f
parent d9cfdd364b64bc11092c4a8cfe6330a4e3cf52cc
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat,  6 Apr 2019 19:45:45 +0200

tweaks: adjust the indentation after the previous change

Also, improve a comment and shorten another, change a 'for' to a 'while'
(as the end point is not known), and rename a parameter from a single
letter to a word.

Diffstat:
Msrc/chars.c | 46++++++++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 22 deletions(-)

diff --git a/src/chars.c b/src/chars.c @@ -572,38 +572,40 @@ char *mbstrchr(const char *s, const char *c) #endif /* !NANO_TINY || ENABLE_JUSTIFY */ #ifndef NANO_TINY -/* This function is equivalent to strpbrk() for multibyte strings. */ -char *mbstrpbrk(const char *s, const char *accept) +/* Locate, in the given string, the first occurrence of any of + * the characters in accept, searching forward. */ +char *mbstrpbrk(const char *string, const char *accept) { - for (; *s != '\0'; s += move_mbright(s, 0)) { - if (mbstrchr(accept, s) != NULL) - return (char *)s; - } + while (*string != '\0') { + if (mbstrchr(accept, string) != NULL) + return (char *)string; - return NULL; + string += move_mbright(string, 0); + } + + return NULL; } /* Locate, in the string that starts at head, the first occurrence of any of - * the characters in the string accept, starting from pointer and searching - * backwards. */ + * the characters in accept, starting from pointer and searching backwards. */ char *mbrevstrpbrk(const char *head, const char *accept, const char *pointer) { - if (*pointer == '\0') { - if (pointer == head) - return NULL; - pointer = head + move_mbleft(head, pointer - head); - } + if (*pointer == '\0') { + if (pointer == head) + return NULL; + pointer = head + move_mbleft(head, pointer - head); + } - while (TRUE) { - if (mbstrchr(accept, pointer) != NULL) - return (char *)pointer; + while (TRUE) { + if (mbstrchr(accept, pointer) != NULL) + return (char *)pointer; - /* If we've reached the head of the string, we found nothing. */ - if (pointer == head) - return NULL; + /* If we've reached the head of the string, we found nothing. */ + if (pointer == head) + return NULL; - pointer = head + move_mbleft(head, pointer - head); - } + pointer = head + move_mbleft(head, pointer - head); + } } #endif /* !NANO_TINY */