Debian Codegraph @

ext/-test-/exception/dataerror.c

raw
1 #include <ruby/ruby.h>
2
3 static void
4 dataerror_mark(void *ptr)
5 {
6 rb_gc_mark((VALUE)ptr);
7 }
8
9 static void
10 dataerror_free(void *ptr)
11 {
12 }
13
14 static const rb_data_type_t dataerror_type = {
15 "Bug #9167",
16 {dataerror_mark, dataerror_free},
17 };
18
19 static VALUE
20 dataerror_alloc(VALUE klass)
21 {
22 VALUE n = rb_str_new_cstr("[Bug #9167] error");
23 return TypedData_Wrap_Struct(klass, &dataerror_type, (void *)n);
24 }
25
26 void
27 Init_dataerror(VALUE klass)
28 {
29 VALUE rb_eDataErr = rb_define_class_under(klass, "DataError", rb_eStandardError);
30 rb_define_alloc_func(rb_eDataErr, dataerror_alloc);
31 }