diff options
Diffstat (limited to 're.c')
-rw-r--r-- | re.c | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -1508,6 +1508,7 @@ static VALUE reg_cache; VALUE rb_reg_regcomp(VALUE str) { + volatile VALUE save_str = str; if (reg_cache && RREGEXP(reg_cache)->len == RSTRING_LEN(str) && case_cache == ruby_ignorecase && kcode_cache == reg_kcode @@ -1516,7 +1517,7 @@ rb_reg_regcomp(VALUE str) case_cache = ruby_ignorecase; kcode_cache = reg_kcode; - return reg_cache = rb_reg_new(RSTRING_PTR(str), RSTRING_LEN(str), + return reg_cache = rb_reg_new(RSTRING_PTR(save_str), RSTRING_LEN(save_str), ruby_ignorecase); } |