Skip to content

Commit 9468fa7

Browse files
committed
mbfl_strlen does not need to use old conversion filters any more
1 parent 950a7db commit 9468fa7

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

ext/mbstring/libmbfl/mbfl/mbfilter.c

+1-16
Original file line numberDiff line numberDiff line change
@@ -447,13 +447,6 @@ const mbfl_encoding *mbfl_identify_encoding(mbfl_string *string, const mbfl_enco
447447
/*
448448
* strlen
449449
*/
450-
static int
451-
filter_count_output(int c, void *data)
452-
{
453-
(*(size_t *)data)++;
454-
return 0;
455-
}
456-
457450
size_t mbfl_strlen(const mbfl_string *string)
458451
{
459452
size_t len = 0;
@@ -472,7 +465,7 @@ size_t mbfl_strlen(const mbfl_string *string)
472465
p += mbtab[*p];
473466
len++;
474467
}
475-
} else if (encoding->to_wchar) {
468+
} else {
476469
uint32_t wchar_buf[128];
477470
unsigned char *in = string->val;
478471
size_t in_len = string->len;
@@ -481,14 +474,6 @@ size_t mbfl_strlen(const mbfl_string *string)
481474
while (in_len) {
482475
len += encoding->to_wchar(&in, &in_len, wchar_buf, 128, &state);
483476
}
484-
} else {
485-
mbfl_convert_filter *filter = mbfl_convert_filter_new(string->encoding, &mbfl_encoding_wchar, filter_count_output, 0, &len);
486-
ZEND_ASSERT(filter);
487-
unsigned char *p = string->val, *e = p + string->len;
488-
while (p < e) {
489-
(*filter->filter_function)(*p++, filter);
490-
}
491-
mbfl_convert_filter_delete(filter);
492477
}
493478

494479
return len;

0 commit comments

Comments
 (0)