]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
telnet: simplify the implementation of str_is_nonascii()
authorKamil Dudka <kdudka@redhat.com>
Tue, 28 Mar 2023 11:41:57 +0000 (13:41 +0200)
committerKamil Dudka <kdudka@redhat.com>
Tue, 28 Mar 2023 13:41:55 +0000 (15:41 +0200)
There is no need to traverse the string twice.

Closes #10852

lib/telnet.c

index e4ffd853ac3da993e0f7a67005cfe2f3843673d0..0f848380060c9e09c1625522025d3a8ba1ab4100 100644 (file)
@@ -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;
 }