mrb_raisef(): new function. Same as previou version of mrb_raise().

mrb_raise(): API modified. It cannot treat variable arguments.
This commit is contained in:
Masaki Muranaka
2012-10-23 09:42:22 +09:00
parent e05bbd45bb
commit 6069a33089
14 changed files with 67 additions and 59 deletions
+11 -3
View File
@@ -217,7 +217,15 @@ mrb_exc_raise(mrb_state *mrb, mrb_value exc)
}
void
mrb_raise(mrb_state *mrb, struct RClass *c, const char *fmt, ...)
mrb_raise(mrb_state *mrb, struct RClass *c, const char *msg)
{
mrb_value mesg;
mesg = mrb_str_new2(mrb, msg);
mrb_exc_raise(mrb, mrb_exc_new3(mrb, c, mesg));
}
void
mrb_raisef(mrb_state *mrb, struct RClass *c, const char *fmt, ...)
{
va_list args;
char buf[256];
@@ -369,7 +377,7 @@ exception_call:
break;
default:
mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%d for 0..3)", argc);
mrb_raisef(mrb, E_ARGUMENT_ERROR, "wrong number of arguments (%d for 0..3)", argc);
break;
}
if (argc > 0) {
@@ -391,7 +399,7 @@ mrb_make_exception(mrb_state *mrb, int argc, mrb_value *argv)
void
mrb_sys_fail(mrb_state *mrb, const char *mesg)
{
mrb_raise(mrb, E_RUNTIME_ERROR, "%s", mesg);
mrb_raise(mrb, E_RUNTIME_ERROR, mesg);
}
void