diff --git a/include/picrin/port.h b/include/picrin/port.h index d5b2eaee..b02c173d 100644 --- a/include/picrin/port.h +++ b/include/picrin/port.h @@ -25,4 +25,6 @@ struct pic_port { #define pic_port_p(v) (pic_type(v) == PIC_TT_PORT) #define pic_port_ptr(v) ((struct pic_port *)pic_ptr(v)) +pic_value pic_eof_object(); + #endif diff --git a/src/port.c b/src/port.c index 0f4a427f..afa84831 100644 --- a/src/port.c +++ b/src/port.c @@ -7,6 +7,16 @@ #include "picrin/blob.h" #include "picrin/macro.h" +pic_value +pic_eof_object() +{ + pic_value v; + + pic_init_value(v, PIC_VTYPE_EOF); + + return v; +} + static void write_pair(pic_state *pic, struct pic_pair *pair); static void write_str(pic_state *pic, struct pic_string *str); @@ -312,13 +322,9 @@ pic_port_eof_object_p(pic_state *pic) static pic_value pic_port_eof_object(pic_state *pic) { - pic_value v; - pic_get_args(pic, ""); - pic_init_value(v, PIC_VTYPE_EOF); - - return v; + return pic_eof_object(); } static pic_value