revert: argc must be size_t type

This commit is contained in:
Yuichi Nishiwaki 2014-09-27 20:17:02 +09:00
parent c808b34a67
commit 186c468c16
14 changed files with 43 additions and 49 deletions

7
blob.c
View File

@ -33,13 +33,13 @@ static pic_value
pic_blob_bytevector(pic_state *pic) pic_blob_bytevector(pic_state *pic)
{ {
pic_value *argv; pic_value *argv;
int argc, i; size_t argc, i;
pic_blob *blob; pic_blob *blob;
unsigned char *data; unsigned char *data;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
blob = pic_make_blob(pic, (size_t)argc); blob = pic_make_blob(pic, argc);
data = blob->data; data = blob->data;
@ -175,8 +175,7 @@ pic_blob_bytevector_copy(pic_state *pic)
static pic_value static pic_value
pic_blob_bytevector_append(pic_state *pic) pic_blob_bytevector_append(pic_state *pic)
{ {
size_t j, len; size_t argc, i, j, len;
int argc, i;
pic_value *argv; pic_value *argv;
pic_blob *blob; pic_blob *blob;

2
bool.c
View File

@ -172,7 +172,7 @@ pic_bool_boolean_p(pic_state *pic)
static pic_value static pic_value
pic_bool_boolean_eq_p(pic_state *pic) pic_bool_boolean_eq_p(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);

2
char.c
View File

@ -42,7 +42,7 @@ pic_char_integer_to_char(pic_state *pic)
static pic_value \ static pic_value \
pic_char_##name##_p(pic_state *pic) \ pic_char_##name##_p(pic_state *pic) \
{ \ { \
int argc, i; \ size_t argc, i; \
pic_value *argv; \ pic_value *argv; \
char c, d; \ char c, d; \
\ \

4
cont.c
View File

@ -96,7 +96,7 @@ pic_load_point(pic_state *pic, struct pic_escape *escape)
noreturn static pic_value noreturn static pic_value
escape_call(pic_state *pic) escape_call(pic_state *pic)
{ {
int argc; size_t argc;
pic_value *argv; pic_value *argv;
struct pic_data *e; struct pic_data *e;
@ -251,7 +251,7 @@ pic_cont_dynamic_wind(pic_state *pic)
static pic_value static pic_value
pic_cont_values(pic_state *pic) pic_cont_values(pic_state *pic)
{ {
int argc; size_t argc;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);

2
dict.c
View File

@ -144,7 +144,7 @@ pic_dict_dictionary(pic_state *pic)
{ {
struct pic_dict *dict; struct pic_dict *dict;
pic_value *argv; pic_value *argv;
int argc, i; size_t argc, i;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);

View File

@ -245,7 +245,7 @@ noreturn static pic_value
pic_error_error(pic_state *pic) pic_error_error(pic_state *pic)
{ {
const char *str; const char *str;
int argc; size_t argc;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "z*", &str, &argc, &argv); pic_get_args(pic, "z*", &str, &argc, &argv);
@ -259,7 +259,7 @@ pic_error_make_error_object(pic_state *pic)
struct pic_error *e; struct pic_error *e;
pic_sym type; pic_sym type;
pic_str *msg; pic_str *msg;
int argc; size_t argc;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "ms*", &type, &msg, &argc, &argv); pic_get_args(pic, "ms*", &type, &msg, &argc, &argv);

8
lib.c
View File

@ -253,7 +253,7 @@ static pic_value
pic_lib_condexpand(pic_state *pic) pic_lib_condexpand(pic_state *pic)
{ {
pic_value *clauses; pic_value *clauses;
int argc, i; size_t argc, i;
pic_get_args(pic, "*", &argc, &clauses); pic_get_args(pic, "*", &argc, &clauses);
@ -269,7 +269,7 @@ pic_lib_condexpand(pic_state *pic)
static pic_value static pic_value
pic_lib_import(pic_state *pic) pic_lib_import(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
@ -284,7 +284,7 @@ pic_lib_import(pic_state *pic)
static pic_value static pic_value
pic_lib_export(pic_state *pic) pic_lib_export(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
@ -300,7 +300,7 @@ static pic_value
pic_lib_define_library(pic_state *pic) pic_lib_define_library(pic_state *pic)
{ {
struct pic_lib *prev = pic->lib; struct pic_lib *prev = pic->lib;
int argc, i; size_t argc, i;
pic_value spec, *argv; pic_value spec, *argv;
pic_get_args(pic, "o*", &spec, &argc, &argv); pic_get_args(pic, "o*", &spec, &argc, &argv);

View File

@ -162,7 +162,7 @@ pic_number_nan_p(pic_state *pic)
static pic_value \ static pic_value \
pic_number_##name(pic_state *pic) \ pic_number_##name(pic_state *pic) \
{ \ { \
int argc, i; \ size_t argc, i; \
pic_value *argv; \ pic_value *argv; \
double f,g; \ double f,g; \
\ \
@ -197,7 +197,7 @@ DEFINE_ARITH_CMP(>=, ge)
static pic_value \ static pic_value \
pic_number_##name(pic_state *pic) \ pic_number_##name(pic_state *pic) \
{ \ { \
int argc, i; \ size_t argc, i; \
pic_value *argv; \ pic_value *argv; \
double f; \ double f; \
bool e = true; \ bool e = true; \
@ -228,7 +228,7 @@ DEFINE_ARITH_OP(*, mul, 1)
static pic_value \ static pic_value \
pic_number_##name(pic_state *pic) \ pic_number_##name(pic_state *pic) \
{ \ { \
int argc, i; \ size_t argc, i; \
pic_value *argv; \ pic_value *argv; \
double f; \ double f; \
bool e; \ bool e; \

8
pair.c
View File

@ -544,7 +544,7 @@ pic_pair_make_list(pic_state *pic)
static pic_value static pic_value
pic_pair_list(pic_state *pic) pic_pair_list(pic_state *pic)
{ {
int argc; size_t argc;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
@ -565,7 +565,7 @@ pic_pair_length(pic_state *pic)
static pic_value static pic_value
pic_pair_append(pic_state *pic) pic_pair_append(pic_state *pic)
{ {
int argc; size_t argc;
pic_value *args, list; pic_value *args, list;
pic_get_args(pic, "*", &argc, &args); pic_get_args(pic, "*", &argc, &args);
@ -641,7 +641,7 @@ static pic_value
pic_pair_map(pic_state *pic) pic_pair_map(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
int argc, i; size_t argc, i;
pic_value *args; pic_value *args;
pic_value arg, ret; pic_value arg, ret;
@ -670,7 +670,7 @@ static pic_value
pic_pair_for_each(pic_state *pic) pic_pair_for_each(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
int argc, i; size_t argc, i;
pic_value *args; pic_value *args;
pic_value arg; pic_value arg;

2
proc.c
View File

@ -61,7 +61,7 @@ pic_proc_apply(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
pic_value *args; pic_value *args;
int argc; size_t argc;
pic_value arg_list; pic_value arg_list;
pic_get_args(pic, "l*", &proc, &argc, &args); pic_get_args(pic, "l*", &proc, &argc, &args);

View File

@ -233,7 +233,7 @@ pic_str_string_p(pic_state *pic)
static pic_value static pic_value
pic_str_string(pic_state *pic) pic_str_string(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_str *str; pic_str *str;
char *buf; char *buf;
@ -289,7 +289,7 @@ pic_str_string_ref(pic_state *pic)
static pic_value \ static pic_value \
pic_str_string_##name(pic_state *pic) \ pic_str_string_##name(pic_state *pic) \
{ \ { \
int argc, i; \ size_t argc, i; \
pic_value *argv; \ pic_value *argv; \
\ \
pic_get_args(pic, "*", &argc, &argv); \ pic_get_args(pic, "*", &argc, &argv); \
@ -337,7 +337,7 @@ pic_str_string_copy(pic_state *pic)
static pic_value static pic_value
pic_str_string_append(pic_state *pic) pic_str_string_append(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_str *str; pic_str *str;
@ -357,14 +357,13 @@ static pic_value
pic_str_string_map(pic_state *pic) pic_str_string_map(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
int argc;
pic_value *argv, vals, val; pic_value *argv, vals, val;
size_t i, len, j; size_t argc, i, len, j;
pic_get_args(pic, "l*", &proc, &argc, &argv); pic_get_args(pic, "l*", &proc, &argc, &argv);
len = SIZE_MAX; len = SIZE_MAX;
for (i = 0; i < (size_t)argc; ++i) { for (i = 0; i < argc; ++i) {
pic_assert_type(pic, argv[i], str); pic_assert_type(pic, argv[i], str);
len = len < pic_strlen(pic_str_ptr(argv[i])) len = len < pic_strlen(pic_str_ptr(argv[i]))
@ -379,7 +378,7 @@ pic_str_string_map(pic_state *pic)
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
vals = pic_nil_value(); vals = pic_nil_value();
for (j = 0; j < (size_t)argc; ++j) { for (j = 0; j < argc; ++j) {
pic_push(pic, pic_char_value(pic_str_ref(pic, pic_str_ptr(argv[j]), i)), vals); pic_push(pic, pic_char_value(pic_str_ref(pic, pic_str_ptr(argv[j]), i)), vals);
} }
val = pic_apply(pic, proc, vals); val = pic_apply(pic, proc, vals);
@ -396,14 +395,13 @@ static pic_value
pic_str_string_for_each(pic_state *pic) pic_str_string_for_each(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
int argc; size_t argc, len, i, j;
size_t len, i, j;
pic_value *argv, vals, val; pic_value *argv, vals, val;
pic_get_args(pic, "l*", &proc, &argc, &argv); pic_get_args(pic, "l*", &proc, &argc, &argv);
len = SIZE_MAX; len = SIZE_MAX;
for (i = 0; i < (size_t)argc; ++i) { for (i = 0; i < argc; ++i) {
pic_assert_type(pic, argv[i], str); pic_assert_type(pic, argv[i], str);
len = len < pic_strlen(pic_str_ptr(argv[i])) len = len < pic_strlen(pic_str_ptr(argv[i]))
@ -416,7 +414,7 @@ pic_str_string_for_each(pic_state *pic)
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
vals = pic_nil_value(); vals = pic_nil_value();
for (j = 0; j < (size_t)argc; ++j) { for (j = 0; j < argc; ++j) {
pic_push(pic, pic_char_value(pic_str_ref(pic, pic_str_ptr(argv[j]), i)), vals); pic_push(pic, pic_char_value(pic_str_ref(pic, pic_str_ptr(argv[j]), i)), vals);
} }
val = pic_apply(pic, proc, vals); val = pic_apply(pic, proc, vals);

View File

@ -108,7 +108,7 @@ pic_symbol_symbol_p(pic_state *pic)
static pic_value static pic_value
pic_symbol_symbol_eq_p(pic_state *pic) pic_symbol_symbol_eq_p(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);

View File

@ -51,7 +51,7 @@ pic_vec_vector_p(pic_state *pic)
static pic_value static pic_value
pic_vec_vector(pic_state *pic) pic_vec_vector(pic_state *pic)
{ {
int argc, i; size_t argc, i;
pic_value *argv; pic_value *argv;
pic_vec *vec; pic_vec *vec;
@ -188,9 +188,8 @@ pic_vec_vector_copy(pic_state *pic)
static pic_value static pic_value
pic_vec_vector_append(pic_state *pic) pic_vec_vector_append(pic_state *pic)
{ {
int argc, i;
pic_value *argv; pic_value *argv;
size_t j, len; size_t argc, i, j, len;
pic_vec *vec; pic_vec *vec;
pic_get_args(pic, "*", &argc, &argv); pic_get_args(pic, "*", &argc, &argv);
@ -242,15 +241,14 @@ static pic_value
pic_vec_vector_map(pic_state *pic) pic_vec_vector_map(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
int argc; size_t argc, i, len, j;
size_t i, len, j;
pic_value *argv, vals; pic_value *argv, vals;
pic_vec *vec; pic_vec *vec;
pic_get_args(pic, "l*", &proc, &argc, &argv); pic_get_args(pic, "l*", &proc, &argc, &argv);
len = INT_MAX; len = INT_MAX;
for (i = 0; i < (size_t)argc; ++i) { for (i = 0; i < argc; ++i) {
pic_assert_type(pic, argv[i], vec); pic_assert_type(pic, argv[i], vec);
len = len < pic_vec_ptr(argv[i])->len len = len < pic_vec_ptr(argv[i])->len
@ -262,7 +260,7 @@ pic_vec_vector_map(pic_state *pic)
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
vals = pic_nil_value(); vals = pic_nil_value();
for (j = 0; j < (size_t)argc; ++j) { for (j = 0; j < argc; ++j) {
pic_push(pic, pic_vec_ptr(argv[j])->data[i], vals); pic_push(pic, pic_vec_ptr(argv[j])->data[i], vals);
} }
vec->data[i] = pic_apply(pic, proc, vals); vec->data[i] = pic_apply(pic, proc, vals);
@ -275,14 +273,13 @@ static pic_value
pic_vec_vector_for_each(pic_state *pic) pic_vec_vector_for_each(pic_state *pic)
{ {
struct pic_proc *proc; struct pic_proc *proc;
int argc; size_t argc, i, len, j;
size_t i, len, j;
pic_value *argv, vals; pic_value *argv, vals;
pic_get_args(pic, "l*", &proc, &argc, &argv); pic_get_args(pic, "l*", &proc, &argc, &argv);
len = INT_MAX; len = INT_MAX;
for (i = 0; i < (size_t)argc; ++i) { for (i = 0; i < argc; ++i) {
pic_assert_type(pic, argv[i], vec); pic_assert_type(pic, argv[i], vec);
len = len < pic_vec_ptr(argv[i])->len len = len < pic_vec_ptr(argv[i])->len
@ -292,7 +289,7 @@ pic_vec_vector_for_each(pic_state *pic)
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {
vals = pic_nil_value(); vals = pic_nil_value();
for (j = 0; j < (size_t)argc; ++j) { for (j = 0; j < argc; ++j) {
pic_push(pic, pic_vec_ptr(argv[j])->data[i], vals); pic_push(pic, pic_vec_ptr(argv[j])->data[i], vals);
} }
pic_apply(pic, proc, vals); pic_apply(pic, proc, vals);

6
vm.c
View File

@ -416,13 +416,13 @@ pic_get_args(pic_state *pic, const char *format, ...)
} }
} }
if ('*' == c) { if ('*' == c) {
int *n; size_t *n;
pic_value **argv; pic_value **argv;
n = va_arg(ap, int *); n = va_arg(ap, size_t *);
argv = va_arg(ap, pic_value **); argv = va_arg(ap, pic_value **);
if (i <= argc) { if (i <= argc) {
*n = argc - i; *n = (size_t)(argc - i);
*argv = &GET_OPERAND(pic, i); *argv = &GET_OPERAND(pic, i);
i = argc; i = argc;
} }