diff options
Diffstat (limited to 'spec/rubyspec/optional/capi/ext/string_spec.c')
-rw-r--r-- | spec/rubyspec/optional/capi/ext/string_spec.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/spec/rubyspec/optional/capi/ext/string_spec.c b/spec/rubyspec/optional/capi/ext/string_spec.c index 69e66fbde1..0568b42212 100644 --- a/spec/rubyspec/optional/capi/ext/string_spec.c +++ b/spec/rubyspec/optional/capi/ext/string_spec.c @@ -257,6 +257,18 @@ VALUE string_spec_rb_str_new5(VALUE self, VALUE str, VALUE ptr, VALUE len) { } #endif +#ifdef HAVE_RB_TAINTED_STR_NEW +VALUE string_spec_rb_tainted_str_new(VALUE self, VALUE str, VALUE len) { + return rb_tainted_str_new(RSTRING_PTR(str), FIX2INT(len)); +} +#endif + +#ifdef HAVE_RB_TAINTED_STR_NEW2 +VALUE string_spec_rb_tainted_str_new2(VALUE self, VALUE str) { + return rb_tainted_str_new2(RSTRING_PTR(str)); +} +#endif + #ifdef HAVE_RB_STR_PLUS VALUE string_spec_rb_str_plus(VALUE self, VALUE str1, VALUE str2) { return rb_str_plus(str1, str2); @@ -564,6 +576,14 @@ void Init_string_spec(void) { rb_define_method(cls, "rb_str_new5", string_spec_rb_str_new5, 3); #endif +#ifdef HAVE_RB_TAINTED_STR_NEW + rb_define_method(cls, "rb_tainted_str_new", string_spec_rb_tainted_str_new, 2); +#endif + +#ifdef HAVE_RB_TAINTED_STR_NEW2 + rb_define_method(cls, "rb_tainted_str_new2", string_spec_rb_tainted_str_new2, 1); +#endif + #ifdef HAVE_RB_STR_PLUS rb_define_method(cls, "rb_str_plus", string_spec_rb_str_plus, 2); #endif |