[libxml2] Update `xmlStrlen()` to use POSIX / ISO C `strlen()`
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Update `xmlStrlen()` to use POSIX / ISO C `strlen()`
- Date: Sat, 26 Feb 2022 16:34:38 +0000 (UTC)
commit 48ed5a74bdf24c630b99b063fa79b1a79c2ae5f3
Author: Mike Dalessio <mike dalessio gmail com>
Date: Mon Feb 21 09:35:59 2022 -0500
Update `xmlStrlen()` to use POSIX / ISO C `strlen()`
This should be faster on a wide range of platforms.
Closes #212
xmlstring.c | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
---
diff --git a/xmlstring.c b/xmlstring.c
index a85685d7..46301c3b 100644
--- a/xmlstring.c
+++ b/xmlstring.c
@@ -424,13 +424,7 @@ xmlStrsub(const xmlChar *str, int start, int len) {
int
xmlStrlen(const xmlChar *str) {
- size_t len = 0;
-
- if (str == NULL) return(0);
- while (*str != 0) { /* non input consuming */
- str++;
- len++;
- }
+ size_t len = str ? strlen((const char *)str) : 0;
return(len > INT_MAX ? 0 : len);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]