aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vm.c5
-rw-r--r--vm_core.h5
2 files changed, 7 insertions, 3 deletions
diff --git a/vm.c b/vm.c
index 6182240526..869d097d7c 100644
--- a/vm.c
+++ b/vm.c
@@ -2130,11 +2130,12 @@ rb_vm_mark(void *ptr)
RUBY_MARK_LEAVE("vm");
}
+#undef rb_vm_register_special_exception
void
-rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE cls, const char *mesg)
+rb_vm_register_special_exception_str(enum ruby_special_exceptions sp, VALUE cls, VALUE mesg)
{
rb_vm_t *vm = GET_VM();
- VALUE exc = rb_exc_new3(cls, rb_obj_freeze(rb_str_new2(mesg)));
+ VALUE exc = rb_exc_new3(cls, rb_obj_freeze(mesg));
OBJ_TAINT(exc);
OBJ_FREEZE(exc);
((VALUE *)vm->special_exceptions)[sp] = exc;
diff --git a/vm_core.h b/vm_core.h
index 56103cfb2c..c414498270 100644
--- a/vm_core.h
+++ b/vm_core.h
@@ -1466,7 +1466,10 @@ void ruby_thread_init_stack(rb_thread_t *th);
int rb_vm_control_frame_id_and_class(const rb_control_frame_t *cfp, ID *idp, ID *called_idp, VALUE *klassp);
void rb_vm_rewind_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
-void rb_vm_register_special_exception(enum ruby_special_exceptions sp, VALUE exception_class, const char *mesg);
+void rb_vm_register_special_exception_str(enum ruby_special_exceptions sp, VALUE exception_class, VALUE mesg);
+
+#define rb_vm_register_special_exception(sp, e, m) \
+ rb_vm_register_special_exception_str(sp, e, rb_usascii_str_new_static((m), (long)rb_strlen_lit(m)))
void rb_gc_mark_machine_stack(rb_thread_t *th);