summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-17 07:11:22 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-17 07:11:22 +0000
commit96b40dff450df701200ea5edceb07f2ed847e3fd (patch)
treea2c90999001ebcb8fd2fd67ffb3d5911a8e98f81 /string.c
parent7dd3853eac98396d3b5abee16d7f680d941eae82 (diff)
2000-02-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@618 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r--string.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/string.c b/string.c
index df483a2..e48a1ec 100644
--- a/string.c
+++ b/string.c
@@ -341,6 +341,13 @@ rb_str_modify(str)
}
VALUE
+rb_str_freeze(str)
+ VALUE str;
+{
+ return rb_obj_freeze(str);
+}
+
+VALUE
rb_str_dup_frozen(str)
VALUE str;
{
@@ -561,6 +568,10 @@ rb_str_index_m(argc, argv, str)
else {
pos = 0;
}
+ if (pos < 0) {
+ pos += RSTRING(str)->len;
+ if (pos < 0) return Qnil;
+ }
switch (TYPE(sub)) {
case T_REGEXP: