From 5080294472c0a484e2b90d705d97170fce229238 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sat, 1 Feb 2014 14:23:21 +0900 Subject: [PATCH] change return value of pic_get_args --- src/number.c | 4 ++-- src/var.c | 4 ++-- src/vector.c | 2 +- src/vm.c | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/number.c b/src/number.c index e5cdde1c..16eecc5e 100644 --- a/src/number.c +++ b/src/number.c @@ -540,7 +540,7 @@ pic_number_log(pic_state *pic) int argc; argc = pic_get_args(pic, "f|f", &f, &g); - if (argc == 2) { + if (argc == 1) { return pic_float_value(log(f)); } else { @@ -605,7 +605,7 @@ pic_number_atan(pic_state *pic) int argc; argc = pic_get_args(pic, "f|f", &f, &g); - if (argc == 2) { + if (argc == 1) { f = atan(f); return pic_float_value(f); } diff --git a/src/var.c b/src/var.c index 6bbd0331..ed975c87 100644 --- a/src/var.c +++ b/src/var.c @@ -80,11 +80,11 @@ var_call(pic_state *pic) proc = pic_get_proc(pic); c = pic_get_args(pic, "|o", &v); - if (c == 1) { + if (c == 0) { var = pic_var_ptr(proc->env->values[0]); return pic_var_ref(pic, var); } - else if (c == 2) { + else if (c == 1) { var = pic_var_ptr(proc->env->values[0]); pic_var_set(pic, var, v); diff --git a/src/vector.c b/src/vector.c index dcfe1bed..b9586976 100644 --- a/src/vector.c +++ b/src/vector.c @@ -70,7 +70,7 @@ pic_vec_make_vector(pic_state *pic) n = pic_get_args(pic, "i|o", &k, &v); vec = pic_vec_new(pic, k); - if (n == 3) { + if (n == 2) { for (i = 0; i < (size_t)k; ++i) { vec->data[i] = v; } diff --git a/src/vm.c b/src/vm.c index f200cab1..0afeced4 100644 --- a/src/vm.c +++ b/src/vm.c @@ -308,7 +308,7 @@ pic_get_args(pic_state *pic, const char *format, ...) pic_error(pic, "wrong number of arguments"); } va_end(ap); - return i; + return i - 1; } void