зеркало из https://github.com/github/ruby.git
* string.c (str_gsub): avoid appending empty pre-match substr.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14944 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
893ee30978
Коммит
389abf1b3b
|
@ -1,3 +1,7 @@
|
|||
Tue Jan 8 15:03:10 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* string.c (str_gsub): avoid appending empty pre-match substr.
|
||||
|
||||
Tue Jan 8 13:05:57 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* compile.c (iseq_build_from_ary), iseq.c (iseq_load): fix for format change.
|
||||
|
|
4
string.c
4
string.c
|
@ -2720,7 +2720,9 @@ str_gsub(int argc, VALUE *argv, VALUE str, int bang)
|
|||
if (OBJ_TAINTED(val)) tainted = 1;
|
||||
|
||||
len = beg - offset; /* copy pre-match substr */
|
||||
rb_enc_str_buf_cat(dest, cp, len, str_enc);
|
||||
if (len) {
|
||||
rb_enc_str_buf_cat(dest, cp, len, str_enc);
|
||||
}
|
||||
|
||||
rb_str_buf_append(dest, val);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче