aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--include/ruby/re.h3
-rw-r--r--re.c8
-rw-r--r--string.c6
-rw-r--r--version.h6
5 files changed, 13 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 4f502b01b1..475ff0395c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,12 @@ Wed Aug 29 18:36:06 2007 Tanaka Akira <akr@fsij.org>
* lib/open-uri.rb: add :ftp_active_mode option.
+Wed Aug 29 14:55:28 2007 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * string.c (str_gsub): should not use mbclen2() which has broken API.
+
+ * re.c: remove rb_reg_mbclen2().
+
Wed Aug 29 12:48:17 2007 Nobuyoshi Nakada <nobu@ruby-lang.org>
* parse.y (aref_args): args may not be a list. [ruby-dev:31592]
diff --git a/include/ruby/re.h b/include/ruby/re.h
index 5b0cc24e9a..c5a62ff117 100644
--- a/include/ruby/re.h
+++ b/include/ruby/re.h
@@ -45,9 +45,6 @@ VALUE rb_reg_quote(VALUE);
RUBY_EXTERN int ruby_ignorecase;
-int rb_reg_mbclen2(unsigned int, VALUE);
-#define mbclen2(c,re) rb_reg_mbclen2((c),(re))
-
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */
diff --git a/re.c b/re.c
index 04ba3e0093..d79f32cceb 100644
--- a/re.c
+++ b/re.c
@@ -376,14 +376,6 @@ kcode_reset_option(void)
}
}
-int
-rb_reg_mbclen2(unsigned int c, VALUE re)
-{
- char uc = (unsigned char)c;
-
- return rb_enc_mbclen(&uc, rb_enc_get(re));
-}
-
static void
rb_reg_check(VALUE re)
{
diff --git a/string.c b/string.c
index dc0796b130..e60e5ff4b0 100644
--- a/string.c
+++ b/string.c
@@ -2244,7 +2244,8 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
int iter = 0;
char *buf, *bp, *sp, *cp;
int tainted = 0;
-
+ rb_encoding *enc;
+
switch (argc) {
case 1:
RETURN_ENUMERATOR(str, argc, argv);
@@ -2260,6 +2261,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
}
pat = get_pat(argv[0], 1);
+ enc = rb_enc_get(pat);
offset=0; n=0;
beg = rb_reg_search(pat, str, 0, 0);
if (beg < 0) {
@@ -2314,7 +2316,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
* in order to prevent infinite loops.
*/
if (RSTRING_LEN(str) <= END(0)) break;
- len = mbclen2(RSTRING_PTR(str)[END(0)], pat);
+ len = rb_enc_mbclen(RSTRING_PTR(str)+END(0), enc);
memcpy(bp, RSTRING_PTR(str)+END(0), len);
bp += len;
offset = END(0) + len;
diff --git a/version.h b/version.h
index b6fb7c36a2..76b06e56ae 100644
--- a/version.h
+++ b/version.h
@@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0"
-#define RUBY_RELEASE_DATE "2007-08-29"
+#define RUBY_RELEASE_DATE "2007-08-30"
#define RUBY_VERSION_CODE 190
-#define RUBY_RELEASE_CODE 20070829
+#define RUBY_RELEASE_CODE 20070830
#define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1
@@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 8
-#define RUBY_RELEASE_DAY 29
+#define RUBY_RELEASE_DAY 30
#ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[];