Skip to content

Commit ca7f556

Browse files
authored
xml: Use strlen() (#20544)
1 parent 586eba9 commit ca7f556

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ext/xml/xml.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ inline static char xml_decode_iso_8859_1(unsigned short);
131131
inline static unsigned short xml_encode_us_ascii(unsigned char);
132132
inline static char xml_decode_us_ascii(unsigned short);
133133
static void xml_xmlchar_zval(const XML_Char *, int, const XML_Char *, zval *);
134-
static int xml_xmlcharlen(const XML_Char *);
134+
static size_t xml_xmlcharlen(const XML_Char *);
135135
static void xml_add_to_info(xml_parser *parser, zend_string *name);
136136
inline static zend_string *xml_decode_tag(xml_parser *parser, const XML_Char *tag);
137137

@@ -536,15 +536,9 @@ static zend_string *xml_utf8_decode(const XML_Char *s, size_t len, const XML_Cha
536536
/* }}} */
537537

538538
/* {{{ xml_xmlcharlen() */
539-
static int xml_xmlcharlen(const XML_Char *s)
539+
static size_t xml_xmlcharlen(const XML_Char *s)
540540
{
541-
int len = 0;
542-
543-
while (*s) {
544-
len++;
545-
s++;
546-
}
547-
return len;
541+
return strlen((const char *) s);
548542
}
549543
/* }}} */
550544

0 commit comments

Comments
 (0)