summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
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: