change return value of pic_get_args

This commit is contained in:
Yuichi Nishiwaki 2014-02-01 14:23:21 +09:00
parent 54b318f3e1
commit 5080294472
4 changed files with 6 additions and 6 deletions

View File

@ -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);
}

View File

@ -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);

View File

@ -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;
}

View File

@ -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