Change some `int` variables to `mrb_int`.
To silence some warnings. This change cancels part of
MODIFY
include/mruby.h
include/mruby.h
@@ -152,8 +152,8 @@ typedef struct {
struct REnv *env;
const mrb_code *pc; /* return address */
const mrb_code *err; /* error position */
- int argc;
- int acc;
+ mrb_int argc;
+ mrb_int acc;
struct RClass *target_class;
} mrb_callinfo;
@@ -1040,8 +1040,8 @@ MRB_API mrb_value mrb_get_arg1(mrb_state *mrb);
* @param ... Variadic values(not type safe!).
* @return [mrb_value] mruby function value.
*/
-MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, int argc, ...);
-MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, int argc, ...);
+MRB_API mrb_value mrb_funcall(mrb_state *mrb, mrb_value val, const char *name, mrb_int argc, ...);
+MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, mrb_int argc, ...);
/**
* Call existing ruby functions. This is basically the type safe version of mrb_funcall.
*
@@ -1070,11 +1070,11 @@ MRB_API mrb_value mrb_funcall_id(mrb_state *mrb, mrb_value val, mrb_sym mid, int
* @return [mrb_value] mrb_value mruby function value.
* @see mrb_funcall
*/
-MRB_API mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name, int argc, const mrb_value *argv);
+MRB_API mrb_value mrb_funcall_argv(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv);
/**
* Call existing ruby functions with a block.
*/
-MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym name, int argc, const mrb_value *argv, mrb_value block);
+MRB_API mrb_value mrb_funcall_with_block(mrb_state *mrb, mrb_value val, mrb_sym name, mrb_int argc, const mrb_value *argv, mrb_value block);
/**
* Create a symbol from C string. But usually it's better to use MRB_SYM(sym) and MRB_QSYM(qsym).
*

MODIFY
src/vm.c
src/vm.c
@@ -333,7 +333,7 @@ static mrb_value mrb_run(mrb_state *mrb, const struct RProc* proc, mrb_value sel
#endif
MRB_API mrb_value
-mrb_funcall(mrb_state *mrb, mrb_value self, const char *name, int argc, ...)
+mrb_funcall(mrb_state *mrb, mrb_value self, const char *name, mrb_int argc, ...)
{
mrb_value argv[MRB_FUNCALL_ARGC_MAX];
va_list ap;
@@ -353,7 +353,7 @@ mrb_funcall(mrb_state *mrb, mrb_value self, const char *name, int argc, ...)
}
MRB_API mrb_value
-mrb_funcall_id(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, ...)
+mrb_funcall_id(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, ...)
{
mrb_value argv[MRB_FUNCALL_ARGC_MAX];
va_list ap;
@@ -396,7 +396,7 @@ ci_nregs(mrb_callinfo *ci)
}
MRB_API mrb_value
-mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, const mrb_value *argv, mrb_value blk)
+mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv, mrb_value blk)
{
mrb_value val;
int ai = mrb_gc_arena_save(mrb);
@@ -497,7 +497,7 @@ mrb_funcall_with_block(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, co
}
MRB_API mrb_value
-mrb_funcall_argv(mrb_state *mrb, mrb_value self, mrb_sym mid, int argc, const mrb_value *argv)
+mrb_funcall_argv(mrb_state *mrb, mrb_value self, mrb_sym mid, mrb_int argc, const mrb_value *argv)
{
return mrb_funcall_with_block(mrb, self, mid, argc, argv, mrb_nil_value());
}
@@ -849,7 +849,7 @@ argnum_error(mrb_state *mrb, mrb_int num)
{
mrb_value exc;
mrb_value str;
- int argc = mrb->c->ci->argc;
+ mrb_int argc = mrb->c->ci->argc;
if (argc < 0) {
mrb_value args = mrb->c->stack[1];
@@ -1568,7 +1568,7 @@ RETRY_TRY_BLOCK:
}
CASE(OP_SUPER, BB) {
- int argc = (b == CALL_MAXARGS) ? -1 : b;
+ mrb_int argc = (b == CALL_MAXARGS) ? -1 : b;
int bidx = (argc < 0) ? a+2 : a+b+1;
mrb_method_t m;
struct RClass *cls;
@@ -1747,22 +1747,22 @@ RETRY_TRY_BLOCK:
}
CASE(OP_ENTER, W) {
- int m1 = MRB_ASPEC_REQ(a);
- int o = MRB_ASPEC_OPT(a);
- int r = MRB_ASPEC_REST(a);
- int m2 = MRB_ASPEC_POST(a);
- int kd = (MRB_ASPEC_KEY(a) > 0 || MRB_ASPEC_KDICT(a))? 1 : 0;
+ mrb_int m1 = MRB_ASPEC_REQ(a);
+ mrb_int o = MRB_ASPEC_OPT(a);
+ mrb_int r = MRB_ASPEC_REST(a);
+ mrb_int m2 = MRB_ASPEC_POST(a);
+ mrb_int kd = (MRB_ASPEC_KEY(a) > 0 || MRB_ASPEC_KDICT(a))? 1 : 0;
/* unused
int b = MRB_ASPEC_BLOCK(a);
*/
- int argc = mrb->c->ci->argc;
+ mrb_int argc = mrb->c->ci->argc;
mrb_value *argv = regs+1;
mrb_value * const argv0 = argv;
- int const len = m1 + o + r + m2;
- int const blk_pos = len + kd + 1;
+ mrb_int const len = m1 + o + r + m2;
+ mrb_int const blk_pos = len + kd + 1;
mrb_value *blk = &argv[argc < 0 ? 1 : argc];
mrb_value kdict = mrb_nil_value();
- int kargs = kd;
+ mrb_int kargs = kd;
/* arguments is passed with Array */
if (argc < 0) {

Change some `int` variables to `mrb_int`.

To silence some warnings. This change cancels part of 7ef3604134.