Fix FTBFS with Ruby 3.x due to removed rb_set_safe_level.

In Ruby 2.7 the entire concept is deprecated and in Ruby 3.x is removed
entirely - see https://bugs.ruby-lang.org/issues/16131

Signed-off-by: Slávek Banko <slavek.banko@axis.cz>
(cherry picked from commit 920d54124a)
r14.0.x
Slávek Banko 3 years ago
parent a7fd7623e1
commit 37fb4f1823
No known key found for this signature in database
GPG Key ID: 608F5293A04BE668

@ -16,6 +16,8 @@
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301, USA.
***************************************************************************/
#include "config.h"
#include "rubyinterpreter.h"
#include <map>
@ -83,12 +85,14 @@ RubyInterpreter::RubyInterpreter(Kross::Api::InterpreterInfo* info): Kross::Api:
{
initRuby();
}
#ifndef HAVE_RUBY_3
if(info->hasOption("safelevel") )
{
kross_rb_set_safe_level( info->getOption("safelevel")->value.toInt() );
} else {
kross_rb_set_safe_level(3); // if the safelevel option is undefined, set it to maximum level
}
#endif
}

@ -17,8 +17,11 @@
* Boston, MA 02110-1301, USA.
***************************************************************************/
#include "config.h"
#include "ruby.h"
void kross_rb_set_safe_level(int safelevel) {
#ifndef HAVE_RUBY_3
rb_set_safe_level(safelevel);
#endif
}

Loading…
Cancel
Save