summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/-test-/exception/enc_raise.c
blob: dc8a42cf3ff47afca42505a4d25271e197cbb643 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <ruby.h>
#include <ruby/encoding.h>

static VALUE
enc_raise(VALUE exc, VALUE encoding, VALUE mesg)
{
    rb_enc_raise(rb_to_encoding(encoding), exc, "%s", StringValueCStr(mesg));
    UNREACHABLE;
}

void
Init_enc_raise(VALUE klass)
{
    rb_define_module_function(klass, "enc_raise", enc_raise, 2);
}