From: Kamil Dudka Date: Tue, 28 Mar 2023 11:41:57 +0000 (+0200) Subject: telnet: simplify the implementation of str_is_nonascii() X-Git-Tag: curl-8_1_0~285 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d92a5007b60e0af7d071ae4da7a2b79c5f4de544;p=thirdparty%2Fcurl.git telnet: simplify the implementation of str_is_nonascii() There is no need to traverse the string twice. Closes #10852 --- diff --git a/lib/telnet.c b/lib/telnet.c index e4ffd853ac..0f84838006 100644 --- a/lib/telnet.c +++ b/lib/telnet.c @@ -772,12 +772,11 @@ static void printsub(struct Curl_easy *data, static bool str_is_nonascii(const char *str) { - size_t len = strlen(str); - while(len--) { - if(*str & 0x80) + char c; + while((c = *str++)) + if(c & 0x80) return TRUE; - str++; - } + return FALSE; }