summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-27 14:27:07 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-01-27 14:27:07 +0000
commitfc208c1bd56a4e3fc03cb2f54616b4479f4b0e41 (patch)
treef29aa519ea99cfcb7a7f13ec44508510d9291a0b /re.c
parent526ab1f0d15247da489cb2fc8af8d4c3f1a71cc2 (diff)
* include/ruby/oniguruma.h: precise mbclen API redesigned to avoid
inline functions. (onigenc_mbclen_charfound): removed. (onigenc_mbclen_needmore): removed. (onigenc_mbclen_recover): removed. (ONIGENC_MBCLEN_CHARFOUND): removed. (ONIGENC_MBCLEN_CHARFOUND_P): defined. (ONIGENC_MBCLEN_CHARFOUND_LEN): defined. (ONIGENC_MBCLEN_INVALID): removed. (ONIGENC_MBCLEN_INVALID_P): defined. (ONIGENC_MBCLEN_NEEDMORE): removed. (ONIGENC_MBCLEN_NEEDMORE_P): defined. (ONIGENC_MBCLEN_NEEDMORE_LEN): defined. (ONIGENC_MBC_ENC_LEN): use onigenc_mbclen_approximate. * regenc.c (onigenc_mbclen_approximate): defined. * include/ruby/encoding.h (MBCLEN_CHARFOUND): removed. (MBCLEN_INVALID): removed. (MBCLEN_NEEDMORE): removed. (MBCLEN_CHARFOUND_P): defined. (MBCLEN_INVALID_P): defined. (MBCLEN_NEEDMORE_P): defined. (MBCLEN_CHARFOUND_LEN): defined. (MBCLEN_NEEDMORE_LEN): defined. * encoding.c: use new API. * re.c: ditto. * string.c: ditto. * parse.y: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 're.c')
-rw-r--r--re.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/re.c b/re.c
index 9d048a8cdd..da9c9ee373 100644
--- a/re.c
+++ b/re.c
@@ -1673,7 +1673,7 @@ unescape_escaped_nonascii(const char **pp, const char *end, rb_encoding *enc,
chbuf[chlen++] = byte;
while (chlen < chmaxlen &&
- MBCLEN_NEEDMORE(rb_enc_precise_mbclen(chbuf, chbuf+chlen, enc))) {
+ MBCLEN_NEEDMORE_P(rb_enc_precise_mbclen(chbuf, chbuf+chlen, enc))) {
byte = read_escaped_byte(&p, end, err);
if (byte == -1) {
return -1;
@@ -1682,7 +1682,7 @@ unescape_escaped_nonascii(const char **pp, const char *end, rb_encoding *enc,
}
l = rb_enc_precise_mbclen(chbuf, chbuf+chlen, enc);
- if (MBCLEN_INVALID(l)) {
+ if (MBCLEN_INVALID_P(l)) {
strcpy(err, "invalid multibyte escape");
return -1;
}
@@ -1812,10 +1812,11 @@ unescape_nonascii(const char *p, const char *end, rb_encoding *enc,
while (p < end) {
int chlen = rb_enc_precise_mbclen(p, end, enc);
- if (!MBCLEN_CHARFOUND(chlen)) {
+ if (!MBCLEN_CHARFOUND_P(chlen)) {
strcpy(err, "invalid multibyte character");
return -1;
}
+ chlen = MBCLEN_CHARFOUND_LEN(chlen);
if (1 < chlen || (*p & 0x80)) {
rb_str_buf_cat(buf, p, chlen);
p += chlen;