1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (str_gsub): should not use mbclen2() which has broken API.

* re.c: remove rb_reg_mbclen2().

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2007-08-29 19:16:02 +00:00
parent 24385e708e
commit 3d7f8c2320
5 changed files with 13 additions and 16 deletions

View file

@ -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. * 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> 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] * parse.y (aref_args): args may not be a list. [ruby-dev:31592]

View file

@ -45,9 +45,6 @@ VALUE rb_reg_quote(VALUE);
RUBY_EXTERN int ruby_ignorecase; 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 defined(__cplusplus)
#if 0 #if 0
{ /* satisfy cc-mode */ { /* satisfy cc-mode */

8
re.c
View file

@ -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 static void
rb_reg_check(VALUE re) rb_reg_check(VALUE re)
{ {

View file

@ -2244,7 +2244,8 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
int iter = 0; int iter = 0;
char *buf, *bp, *sp, *cp; char *buf, *bp, *sp, *cp;
int tainted = 0; int tainted = 0;
rb_encoding *enc;
switch (argc) { switch (argc) {
case 1: case 1:
RETURN_ENUMERATOR(str, argc, argv); 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); pat = get_pat(argv[0], 1);
enc = rb_enc_get(pat);
offset=0; n=0; offset=0; n=0;
beg = rb_reg_search(pat, str, 0, 0); beg = rb_reg_search(pat, str, 0, 0);
if (beg < 0) { if (beg < 0) {
@ -2314,7 +2316,7 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
* in order to prevent infinite loops. * in order to prevent infinite loops.
*/ */
if (RSTRING_LEN(str) <= END(0)) break; 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); memcpy(bp, RSTRING_PTR(str)+END(0), len);
bp += len; bp += len;
offset = END(0) + len; offset = END(0) + len;

View file

@ -1,7 +1,7 @@
#define RUBY_VERSION "1.9.0" #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_VERSION_CODE 190
#define RUBY_RELEASE_CODE 20070829 #define RUBY_RELEASE_CODE 20070830
#define RUBY_PATCHLEVEL 0 #define RUBY_PATCHLEVEL 0
#define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MAJOR 1
@ -9,7 +9,7 @@
#define RUBY_VERSION_TEENY 0 #define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_YEAR 2007
#define RUBY_RELEASE_MONTH 8 #define RUBY_RELEASE_MONTH 8
#define RUBY_RELEASE_DAY 29 #define RUBY_RELEASE_DAY 30
#ifdef RUBY_EXTERN #ifdef RUBY_EXTERN
RUBY_EXTERN const char ruby_version[]; RUBY_EXTERN const char ruby_version[];