Skip to content

Commit d3f56e5

Browse files
committed
Rename php_mb_mbchar_bytes_ex to php_mb_mbchar_bytes
...And remove the original php_mb_mbchar_bytes, which was not being used.
1 parent 774cd96 commit d3f56e5

File tree

3 files changed

+11
-21
lines changed

3 files changed

+11
-21
lines changed

ext/mbstring/mbstring.c

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,7 @@ static char *php_mb_rfc1867_substring_conf(const zend_encoding *encoding, char *
562562
if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) {
563563
*resp++ = start[++i];
564564
} else {
565-
size_t j = php_mb_mbchar_bytes_ex(start+i, (const mbfl_encoding *)encoding);
565+
size_t j = php_mb_mbchar_bytes(start+i, (const mbfl_encoding *)encoding);
566566

567567
while (j-- > 0 && i < len) {
568568
*resp++ = start[i++];
@@ -594,7 +594,7 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,
594594
++pos;
595595
}
596596
} else {
597-
pos += php_mb_mbchar_bytes_ex(pos, (const mbfl_encoding *)encoding);
597+
pos += php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
598598

599599
}
600600
}
@@ -607,7 +607,7 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,
607607
res = estrndup(*line, pos - *line);
608608

609609
while (*pos == stop) {
610-
pos += php_mb_mbchar_bytes_ex(pos, (const mbfl_encoding *)encoding);
610+
pos += php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
611611
}
612612

613613
*line = pos;
@@ -4203,8 +4203,7 @@ static int php_mb_encoding_translation(void)
42034203
}
42044204
/* }}} */
42054205

4206-
/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes_ex() */
4207-
MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc)
4206+
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s, const mbfl_encoding *enc)
42084207
{
42094208
if (enc) {
42104209
if (enc->mblen_table) {
@@ -4219,14 +4218,6 @@ MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *e
42194218
}
42204219
return 1;
42214220
}
4222-
/* }}} */
4223-
4224-
/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes() */
4225-
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s)
4226-
{
4227-
return php_mb_mbchar_bytes_ex(s, MBSTRG(internal_encoding));
4228-
}
4229-
/* }}} */
42304221

42314222
MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes, const mbfl_encoding *enc)
42324223
{
@@ -4241,7 +4232,7 @@ MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nby
42414232
if ((unsigned char)*p == (unsigned char)c) {
42424233
last = (char *)p;
42434234
}
4244-
nb = php_mb_mbchar_bytes_ex(p, enc);
4235+
nb = php_mb_mbchar_bytes(p, enc);
42454236
if (nb == 0) {
42464237
return NULL; /* something is going wrong! */
42474238
}
@@ -4256,7 +4247,7 @@ MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nby
42564247
if ((unsigned char)*p == (unsigned char)c) {
42574248
last = (char *)p;
42584249
}
4259-
nbytes_char = php_mb_mbchar_bytes_ex(p, enc);
4250+
nbytes_char = php_mb_mbchar_bytes(p, enc);
42604251
if (bcnt < nbytes_char) {
42614252
return NULL;
42624253
}

ext/mbstring/mbstring.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ MBSTRING_API char * php_mb_convert_encoding(
6262
const char *input, size_t length, const mbfl_encoding *to_encoding,
6363
const mbfl_encoding **from_encodings, size_t num_from_encodings, size_t *output_len);
6464

65-
MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
66-
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s);
65+
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s, const mbfl_encoding *enc);
6766

6867
MBSTRING_API size_t php_mb_stripos(int mode, const char *old_haystack, size_t old_haystack_len, const char *old_needle, size_t old_needle_len, zend_long offset, const mbfl_encoding *encoding);
6968
MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const mbfl_encoding *encoding);

ext/mbstring/php_mbregex.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -721,15 +721,15 @@ static inline void mb_regex_substitute(
721721
eos = replace + replace_len;
722722

723723
while (p < eos) {
724-
clen = (int) php_mb_mbchar_bytes_ex(p, enc);
724+
clen = (int) php_mb_mbchar_bytes(p, enc);
725725
if (clen != 1 || p == eos || p[0] != '\\') {
726726
/* skip anything that's not an ascii backslash */
727727
smart_str_appendl(pbuf, p, clen);
728728
p += clen;
729729
continue;
730730
}
731731
sp = p; /* save position */
732-
clen = (int) php_mb_mbchar_bytes_ex(++p, enc);
732+
clen = (int) php_mb_mbchar_bytes(++p, enc);
733733
if (clen != 1 || p == eos) {
734734
/* skip backslash followed by multibyte char */
735735
smart_str_appendl(pbuf, sp, p - sp);
@@ -759,7 +759,7 @@ static inline void mb_regex_substitute(
759759
break;
760760
case 'k':
761761
{
762-
clen = (int) php_mb_mbchar_bytes_ex(++p, enc);
762+
clen = (int) php_mb_mbchar_bytes(++p, enc);
763763
if (clen != 1 || p == eos || (p[0] != '<' && p[0] != '\'')) {
764764
/* not a backref delimiter */
765765
p += clen;
@@ -772,7 +772,7 @@ static inline void mb_regex_substitute(
772772
char maybe_num = 1;
773773
name_end = name = p + 1;
774774
while (name_end < eos) {
775-
clen = (int) php_mb_mbchar_bytes_ex(name_end, enc);
775+
clen = (int) php_mb_mbchar_bytes(name_end, enc);
776776
if (clen != 1) {
777777
name_end += clen;
778778
maybe_num = 0;

0 commit comments

Comments
 (0)