summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-17 07:30:37 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-11-17 07:30:37 +0000
commitb1d45b805c22e9dba70400100aa080c515e0f2c9 (patch)
tree4aface79ce936ccfadbedab533c57b939bbcee8d /string.c
parentaa6ca26e8bdb71795582d9f0d511cf370f9fe585 (diff)
19991117
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/string.c b/string.c
index 39d7bef466..3214c20adb 100644
--- a/string.c
+++ b/string.c
@@ -112,9 +112,10 @@ rb_str_new4(orig)
str->ptr = RSTRING(orig)->ptr;
RSTRING(orig)->orig = (VALUE)str;
str->orig = 0;
- if (FL_TEST(str, FL_TAINT)) {
+ if (FL_TEST(orig, FL_TAINT)) {
FL_SET(str, FL_TAINT);
}
+ FL_SET(str, STR_FREEZE);
return (VALUE)str;
}
}
@@ -1111,7 +1112,7 @@ rb_str_gsub_bang(argc, argv, str)
* Always consume at least one character of the input string
* in order to prevent infinite loops.
*/
- len = mbclen(RSTRING(str)->ptr[END(0)]);
+ len = mbclen2(RSTRING(str)->ptr[END(0)], pat);
if (RSTRING(str)->len > END(0)) {
memcpy(bp, RSTRING(str)->ptr+END(0), len);
bp += len;
@@ -1344,12 +1345,6 @@ rb_str_inspect(str)
*b++ = *p++;
}
}
-#if 0
- else if ((c & 0x80) && rb_kcode() != MBCTYPE_EUC) {
- CHECK(1);
- *b++ = c;
- }
-#endif
else if (c == '"'|| c == '\\') {
CHECK(2);
*b++ = '\\';
@@ -2084,11 +2079,11 @@ rb_str_split_method(argc, argv, str)
regs = RMATCH(rb_backref_get())->regs;
if (start == end && BEG(0) == END(0)) {
if (last_null == 1) {
- rb_ary_push(result, rb_str_substr(str, beg, mbclen(RSTRING(str)->ptr[beg])));
+ rb_ary_push(result, rb_str_substr(str, beg, mbclen2(RSTRING(str)->ptr[beg],spat)));
beg = start;
}
else {
- start += mbclen(RSTRING(str)->ptr[start]);
+ start += mbclen2(RSTRING(str)->ptr[start],spat);
last_null = 1;
continue;
}
@@ -2398,7 +2393,7 @@ scan_once(str, pat, start)
/*
* Always consume at least one character of the input string
*/
- *start = END(0)+mbclen(RSTRING(str)->ptr[END(0)]);
+ *start = END(0)+mbclen2(RSTRING(str)->ptr[END(0)],pat);
}
else {
*start = END(0);