ruby-changes:58805
From: Jeremy <ko1@a...>
Date: Mon, 18 Nov 2019 08:09:25 +0900 (JST)
Subject: [ruby-changes:58805] d03da13b17 (master): [ruby/strscan] Remove taint support
https://git.ruby-lang.org/ruby.git/commit/?id=d03da13b17 From d03da13b17484cb3f8697e9125e028eb65ef7a39 Mon Sep 17 00:00:00 2001 From: Jeremy Evans <code@j...> Date: Thu, 14 Nov 2019 16:56:02 -0800 Subject: [ruby/strscan] Remove taint support Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. diff --git a/ext/strscan/strscan.c b/ext/strscan/strscan.c index 84bf884..b6d1799 100644 --- a/ext/strscan/strscan.c +++ b/ext/strscan/strscan.c @@ -77,7 +77,6 @@ struct strscanner https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L77 ======================================================================= */ static inline long minl _((const long n, const long x)); -static VALUE infect _((VALUE str, struct strscanner *p)); static VALUE extract_range _((struct strscanner *p, long beg_i, long end_i)); static VALUE extract_beg_len _((struct strscanner *p, long beg_i, long len)); @@ -139,13 +138,6 @@ static VALUE inspect2 _((struct strscanner *p)); https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L138 ======================================================================= */ static VALUE -infect(VALUE str, struct strscanner *p) -{ - OBJ_INFECT(str, p->str); - return str; -} - -static VALUE str_new(struct strscanner *p, const char *ptr, long len) { VALUE str = rb_str_new(ptr, len); @@ -164,7 +156,7 @@ extract_range(struct strscanner *p, long beg_i, long end_i) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L156 { if (beg_i > S_LEN(p)) return Qnil; end_i = minl(end_i, S_LEN(p)); - return infect(str_new(p, S_PBEG(p) + beg_i, end_i - beg_i), p); + return str_new(p, S_PBEG(p) + beg_i, end_i - beg_i); } static VALUE @@ -172,7 +164,7 @@ extract_beg_len(struct strscanner *p, long beg_i, long len) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L164 { if (beg_i > S_LEN(p)) return Qnil; len = minl(len, S_LEN(p) - beg_i); - return infect(str_new(p, S_PBEG(p) + beg_i, len), p); + return str_new(p, S_PBEG(p) + beg_i, len); } /* ======================================================================= @@ -950,7 +942,7 @@ strscan_peek(VALUE self, VALUE vlen) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L942 len = NUM2LONG(vlen); if (EOS_P(p)) - return infect(str_new(p, "", 0), p); + return str_new(p, "", 0); len = minl(len, S_RESTLEN(p)); return extract_beg_len(p, p->curr, len); @@ -1336,7 +1328,7 @@ strscan_rest(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1328 GET_SCANNER(self, p); if (EOS_P(p)) { - return infect(str_new(p, "", 0), p); + return str_new(p, "", 0); } return extract_range(p, p->curr, S_LEN(p)); } @@ -1391,11 +1383,11 @@ strscan_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1383 p = check_strscan(self); if (NIL_P(p->str)) { a = rb_sprintf("#<%"PRIsVALUE" (uninitialized)>", rb_obj_class(self)); - return infect(a, p); + return a; } if (EOS_P(p)) { a = rb_sprintf("#<%"PRIsVALUE" fin>", rb_obj_class(self)); - return infect(a, p); + return a; } if (p->curr == 0) { b = inspect2(p); @@ -1403,7 +1395,7 @@ strscan_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1395 rb_obj_class(self), p->curr, S_LEN(p), b); - return infect(a, p); + return a; } a = inspect1(p); b = inspect2(p); @@ -1411,7 +1403,7 @@ strscan_inspect(VALUE self) https://github.com/ruby/ruby/blob/trunk/ext/strscan/strscan.c#L1403 rb_obj_class(self), p->curr, S_LEN(p), a, b); - return infect(a, p); + return a; } static VALUE -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/