summaryrefslogtreecommitdiff
path: root/ext/-test-/fatal/rb_fatal.c
blob: eedbc51f8b83d639577ecdf9e4e801fe8eff9900 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <ruby.h>

static VALUE
ruby_fatal(VALUE obj, VALUE msg)
{
    const char *cmsg = NULL;

    (void)obj;

    cmsg = RSTRING_PTR(msg);
    rb_fatal("%s", cmsg);
    return 0; /* never reached */
}

void
Init_rb_fatal(void)
{
    VALUE mBug = rb_define_module("Bug");
    rb_define_singleton_method(mBug, "rb_fatal", ruby_fatal, 1);
}