mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
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:
+11
-3
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user