mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Rename php_mb_mbchar_bytes_ex to php_mb_mbchar_bytes
...And remove the original php_mb_mbchar_bytes, which was not being used.
This commit is contained in:
parent
774cd960ab
commit
d3f56e5ac9
3 changed files with 11 additions and 21 deletions
|
@ -562,7 +562,7 @@ static char *php_mb_rfc1867_substring_conf(const zend_encoding *encoding, char *
|
||||||
if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) {
|
if (start[i] == '\\' && (start[i + 1] == '\\' || (quote && start[i + 1] == quote))) {
|
||||||
*resp++ = start[++i];
|
*resp++ = start[++i];
|
||||||
} else {
|
} else {
|
||||||
size_t j = php_mb_mbchar_bytes_ex(start+i, (const mbfl_encoding *)encoding);
|
size_t j = php_mb_mbchar_bytes(start+i, (const mbfl_encoding *)encoding);
|
||||||
|
|
||||||
while (j-- > 0 && i < len) {
|
while (j-- > 0 && i < len) {
|
||||||
*resp++ = start[i++];
|
*resp++ = start[i++];
|
||||||
|
@ -594,7 +594,7 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,
|
||||||
++pos;
|
++pos;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pos += php_mb_mbchar_bytes_ex(pos, (const mbfl_encoding *)encoding);
|
pos += php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -607,7 +607,7 @@ static char *php_mb_rfc1867_getword(const zend_encoding *encoding, char **line,
|
||||||
res = estrndup(*line, pos - *line);
|
res = estrndup(*line, pos - *line);
|
||||||
|
|
||||||
while (*pos == stop) {
|
while (*pos == stop) {
|
||||||
pos += php_mb_mbchar_bytes_ex(pos, (const mbfl_encoding *)encoding);
|
pos += php_mb_mbchar_bytes(pos, (const mbfl_encoding *)encoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
*line = pos;
|
*line = pos;
|
||||||
|
@ -4203,8 +4203,7 @@ static int php_mb_encoding_translation(void)
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes_ex() */
|
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s, const mbfl_encoding *enc)
|
||||||
MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc)
|
|
||||||
{
|
{
|
||||||
if (enc) {
|
if (enc) {
|
||||||
if (enc->mblen_table) {
|
if (enc->mblen_table) {
|
||||||
|
@ -4219,14 +4218,6 @@ MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *e
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
/* {{{ MBSTRING_API size_t php_mb_mbchar_bytes() */
|
|
||||||
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s)
|
|
||||||
{
|
|
||||||
return php_mb_mbchar_bytes_ex(s, MBSTRG(internal_encoding));
|
|
||||||
}
|
|
||||||
/* }}} */
|
|
||||||
|
|
||||||
MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes, const mbfl_encoding *enc)
|
MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nbytes, const mbfl_encoding *enc)
|
||||||
{
|
{
|
||||||
|
@ -4241,7 +4232,7 @@ MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nby
|
||||||
if ((unsigned char)*p == (unsigned char)c) {
|
if ((unsigned char)*p == (unsigned char)c) {
|
||||||
last = (char *)p;
|
last = (char *)p;
|
||||||
}
|
}
|
||||||
nb = php_mb_mbchar_bytes_ex(p, enc);
|
nb = php_mb_mbchar_bytes(p, enc);
|
||||||
if (nb == 0) {
|
if (nb == 0) {
|
||||||
return NULL; /* something is going wrong! */
|
return NULL; /* something is going wrong! */
|
||||||
}
|
}
|
||||||
|
@ -4256,7 +4247,7 @@ MBSTRING_API char *php_mb_safe_strrchr(const char *s, unsigned int c, size_t nby
|
||||||
if ((unsigned char)*p == (unsigned char)c) {
|
if ((unsigned char)*p == (unsigned char)c) {
|
||||||
last = (char *)p;
|
last = (char *)p;
|
||||||
}
|
}
|
||||||
nbytes_char = php_mb_mbchar_bytes_ex(p, enc);
|
nbytes_char = php_mb_mbchar_bytes(p, enc);
|
||||||
if (bcnt < nbytes_char) {
|
if (bcnt < nbytes_char) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,8 +62,7 @@ MBSTRING_API char * php_mb_convert_encoding(
|
||||||
const char *input, size_t length, const mbfl_encoding *to_encoding,
|
const char *input, size_t length, const mbfl_encoding *to_encoding,
|
||||||
const mbfl_encoding **from_encodings, size_t num_from_encodings, size_t *output_len);
|
const mbfl_encoding **from_encodings, size_t num_from_encodings, size_t *output_len);
|
||||||
|
|
||||||
MBSTRING_API size_t php_mb_mbchar_bytes_ex(const char *s, const mbfl_encoding *enc);
|
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s, const mbfl_encoding *enc);
|
||||||
MBSTRING_API size_t php_mb_mbchar_bytes(const char *s);
|
|
||||||
|
|
||||||
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);
|
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);
|
||||||
MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const mbfl_encoding *encoding);
|
MBSTRING_API int php_mb_check_encoding(const char *input, size_t length, const mbfl_encoding *encoding);
|
||||||
|
|
|
@ -721,7 +721,7 @@ static inline void mb_regex_substitute(
|
||||||
eos = replace + replace_len;
|
eos = replace + replace_len;
|
||||||
|
|
||||||
while (p < eos) {
|
while (p < eos) {
|
||||||
clen = (int) php_mb_mbchar_bytes_ex(p, enc);
|
clen = (int) php_mb_mbchar_bytes(p, enc);
|
||||||
if (clen != 1 || p == eos || p[0] != '\\') {
|
if (clen != 1 || p == eos || p[0] != '\\') {
|
||||||
/* skip anything that's not an ascii backslash */
|
/* skip anything that's not an ascii backslash */
|
||||||
smart_str_appendl(pbuf, p, clen);
|
smart_str_appendl(pbuf, p, clen);
|
||||||
|
@ -729,7 +729,7 @@ static inline void mb_regex_substitute(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
sp = p; /* save position */
|
sp = p; /* save position */
|
||||||
clen = (int) php_mb_mbchar_bytes_ex(++p, enc);
|
clen = (int) php_mb_mbchar_bytes(++p, enc);
|
||||||
if (clen != 1 || p == eos) {
|
if (clen != 1 || p == eos) {
|
||||||
/* skip backslash followed by multibyte char */
|
/* skip backslash followed by multibyte char */
|
||||||
smart_str_appendl(pbuf, sp, p - sp);
|
smart_str_appendl(pbuf, sp, p - sp);
|
||||||
|
@ -759,7 +759,7 @@ static inline void mb_regex_substitute(
|
||||||
break;
|
break;
|
||||||
case 'k':
|
case 'k':
|
||||||
{
|
{
|
||||||
clen = (int) php_mb_mbchar_bytes_ex(++p, enc);
|
clen = (int) php_mb_mbchar_bytes(++p, enc);
|
||||||
if (clen != 1 || p == eos || (p[0] != '<' && p[0] != '\'')) {
|
if (clen != 1 || p == eos || (p[0] != '<' && p[0] != '\'')) {
|
||||||
/* not a backref delimiter */
|
/* not a backref delimiter */
|
||||||
p += clen;
|
p += clen;
|
||||||
|
@ -772,7 +772,7 @@ static inline void mb_regex_substitute(
|
||||||
char maybe_num = 1;
|
char maybe_num = 1;
|
||||||
name_end = name = p + 1;
|
name_end = name = p + 1;
|
||||||
while (name_end < eos) {
|
while (name_end < eos) {
|
||||||
clen = (int) php_mb_mbchar_bytes_ex(name_end, enc);
|
clen = (int) php_mb_mbchar_bytes(name_end, enc);
|
||||||
if (clen != 1) {
|
if (clen != 1) {
|
||||||
name_end += clen;
|
name_end += clen;
|
||||||
maybe_num = 0;
|
maybe_num = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue