]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
strops: use strlen instead of strchr for string length
authorKacper Piwiński <vfjpl1@gmail.com>
Mon, 1 Dec 2025 15:42:54 +0000 (16:42 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Mon, 1 Dec 2025 15:42:54 +0000 (16:42 +0100)
For wide string the equivalent funtion __wcslen is used. This change
makes it more symetrical.

Reviewed-by: Florian Weimer <fweimer@redhat.com>
libio/strops.c

index ec75530e14d88c0c73affc97bc41645cb131196e..9243a87592f9287aee665cb29c47cf213c750f57 100644 (file)
@@ -38,7 +38,7 @@ _IO_str_init_static_internal (_IO_strfile *sf, char *ptr, size_t size,
   char *end;
 
   if (size == 0)
-    end = strchr (ptr, '\0');
+    end = ptr + strlen (ptr);
   else if ((size_t) ptr + size > (size_t) ptr)
     end = ptr + size;
   else