remove pic_make_vec_from_list

This commit is contained in:
Yuichi Nishiwaki 2015-07-13 08:28:21 +09:00
parent 5c5066bfa0
commit cbe5e81b28
3 changed files with 11 additions and 20 deletions

View File

@ -18,8 +18,7 @@ struct pic_vector {
#define pic_vec_p(v) (pic_type(v) == PIC_TT_VECTOR)
#define pic_vec_ptr(o) ((struct pic_vector *)pic_ptr(o))
struct pic_vector *pic_make_vec(pic_state *, size_t);
struct pic_vector *pic_make_vec_from_list(pic_state *, pic_value);
pic_vec *pic_make_vec(pic_state *, size_t);
#if defined(__cplusplus)
}

View File

@ -643,11 +643,19 @@ read_pair(pic_state *pic, struct pic_port *port, int c)
static pic_value
read_vector(pic_state *pic, struct pic_port *port, int c)
{
pic_value list;
pic_value list, it, elem;
pic_vec *vec;
size_t i = 0;
list = read(pic, port, c);
return pic_obj_value(pic_make_vec_from_list(pic, list));
vec = pic_make_vec(pic, pic_length(pic, list));
pic_for_each (elem, list, it) {
vec->data[i++] = elem;
}
return pic_obj_value(vec);
}
static pic_value

View File

@ -19,22 +19,6 @@ pic_make_vec(pic_state *pic, size_t len)
return vec;
}
struct pic_vector *
pic_make_vec_from_list(pic_state *pic, pic_value data)
{
struct pic_vector *vec;
size_t len, i;
len = pic_length(pic, data);
vec = pic_make_vec(pic, len);
for (i = 0; i < len; ++i) {
vec->data[i] = pic_car(pic, data);
data = pic_cdr(pic, data);
}
return vec;
}
static pic_value
pic_vec_vector_p(pic_state *pic)
{