aboutsummaryrefslogtreecommitdiffstats
path: root/re.c
diff options
context:
space:
mode:
authorJeremy Evans <code@jeremyevans.net>2019-09-24 20:59:12 -0700
committerJeremy Evans <code@jeremyevans.net>2019-11-18 01:00:25 +0200
commitffd0820ab317542f8780aac475da590a4bdbc7a8 (patch)
tree6a5d774933c15fd2b9ea948bd3ae2fa587faaf82 /re.c
parentc5c05460ac20abcbc0ed686eb4acf06da7a39a79 (diff)
downloadruby-ffd0820ab317542f8780aac475da590a4bdbc7a8.tar.gz
Deprecate taint/trust and related methods, and make the methods no-ops
This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
Diffstat (limited to 're.c')
-rw-r--r--re.c25
1 files changed, 0 insertions, 25 deletions
diff --git a/re.c b/re.c
index 4b9d662525..11f4679721 100644
--- a/re.c
+++ b/re.c
@@ -462,7 +462,6 @@ rb_reg_desc(const char *s, long len, VALUE re)
if (RBASIC(re)->flags & REG_ENCODING_NONE)
rb_str_buf_cat2(str, "n");
}
- OBJ_INFECT(str, re);
return str;
}
@@ -488,7 +487,6 @@ rb_reg_source(VALUE re)
rb_reg_check(re);
str = rb_str_dup(RREGEXP_SRC(re));
- if (OBJ_TAINTED(re)) OBJ_TAINT(str);
return str;
}
@@ -647,7 +645,6 @@ rb_reg_str_with_term(VALUE re, int term)
}
rb_enc_copy(str, re);
- OBJ_INFECT(str, re);
return str;
}
@@ -1337,7 +1334,6 @@ match_set_string(VALUE m, VALUE string, long pos, long len)
if (err) rb_memerror();
rmatch->regs.beg[0] = pos;
rmatch->regs.end[0] = pos + len;
- OBJ_INFECT(match, string);
}
void
@@ -1601,20 +1597,14 @@ rb_reg_search0(VALUE re, VALUE str, long pos, int reverse, int set_backref_str)
onig_region_free(regs, 0);
if (err) rb_memerror();
}
- else {
- FL_UNSET(match, FL_TAINT);
- }
if (set_backref_str) {
RMATCH(match)->str = rb_str_new4(str);
- OBJ_INFECT(match, str);
}
RMATCH(match)->regexp = re;
rb_backref_set(match);
- OBJ_INFECT(match, re);
-
return result;
}
@@ -1685,18 +1675,12 @@ rb_reg_start_with_p(VALUE re, VALUE str)
onig_region_free(regs, 0);
if (err) rb_memerror();
}
- else {
- FL_UNSET(match, FL_TAINT);
- }
RMATCH(match)->str = rb_str_new4(str);
- OBJ_INFECT(match, str);
RMATCH(match)->regexp = re;
rb_backref_set(match);
- OBJ_INFECT(match, re);
-
return true;
}
@@ -1740,7 +1724,6 @@ rb_reg_nth_match(int nth, VALUE match)
end = END(nth);
len = end - start;
str = rb_str_subseq(RMATCH(match)->str, start, len);
- OBJ_INFECT(str, match);
return str;
}
@@ -1773,7 +1756,6 @@ rb_reg_match_pre(VALUE match)
regs = RMATCH_REGS(match);
if (BEG(0) == -1) return Qnil;
str = rb_str_subseq(RMATCH(match)->str, 0, BEG(0));
- if (OBJ_TAINTED(match)) OBJ_TAINT(str);
return str;
}
@@ -1803,7 +1785,6 @@ rb_reg_match_post(VALUE match)
str = RMATCH(match)->str;
pos = END(0);
str = rb_str_subseq(str, pos, RSTRING_LEN(str) - pos);
- if (OBJ_TAINTED(match)) OBJ_TAINT(str);
return str;
}
@@ -1855,7 +1836,6 @@ match_array(VALUE match, int start)
VALUE ary;
VALUE target;
int i;
- int taint = OBJ_TAINTED(match);
match_check(match);
regs = RMATCH_REGS(match);
@@ -1868,7 +1848,6 @@ match_array(VALUE match, int start)
}
else {
VALUE str = rb_str_subseq(target, regs->beg[i], regs->end[i]-regs->beg[i]);
- if (taint) OBJ_TAINT(str);
rb_ary_push(ary, str);
}
}
@@ -2129,8 +2108,6 @@ match_to_s(VALUE match)
match_check(match);
if (NIL_P(str)) str = rb_str_new(0,0);
- if (OBJ_TAINTED(match)) OBJ_TAINT(str);
- if (OBJ_TAINTED(RMATCH(match)->str)) OBJ_TAINT(str);
return str;
}
@@ -2891,7 +2868,6 @@ rb_reg_initialize_str(VALUE obj, VALUE str, int options, onig_errmsg_buffer err,
}
ret = rb_reg_initialize(obj, RSTRING_PTR(str), RSTRING_LEN(str), enc,
options, err, sourcefile, sourceline);
- OBJ_INFECT(obj, str);
if (ret == 0) reg_set_source(obj, str, str_enc);
return ret;
}
@@ -3580,7 +3556,6 @@ rb_reg_quote(VALUE str)
t += rb_enc_mbcput(c, t, enc);
}
rb_str_resize(tmp, t - RSTRING_PTR(tmp));
- OBJ_INFECT(tmp, str);
return tmp;
}