diff options
author | Adrian Thurston <thurston@colm.net> | 2018-06-18 15:07:13 +0700 |
---|---|---|
committer | Adrian Thurston <thurston@colm.net> | 2018-06-18 15:07:13 +0700 |
commit | ede4dab4be16e03d28b779e9e56e86a56be27199 (patch) | |
tree | 962cdec58d62d6d9e7c2282992101fee2f415fa7 /src/input.c | |
parent | 9c76ff83caf59acd8678cc62414efb063470a314 (diff) | |
download | colm-ede4dab4be16e03d28b779e9e56e86a56be27199.tar.gz |
collect and file operations only need to be in stream_impl_data
Diffstat (limited to 'src/input.c')
-rw-r--r-- | src/input.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/input.c b/src/input.c index 2fd1d65a..04e9610b 100644 --- a/src/input.c +++ b/src/input.c @@ -328,7 +328,7 @@ static void data_destructor( program_t *prg, tree_t **sp, struct stream_impl_dat static str_collect_t *data_get_collect( struct stream_impl_data *si ) { - return 0; + return si->collect; } static void data_flush_stream( struct stream_impl_data *si ) @@ -632,7 +632,7 @@ static void stream_destructor( program_t *prg, tree_t **sp, struct stream_impl_s static str_collect_t *stream_get_collect( struct stream_impl_seq *si ) { - return si->collect; + return 0; } static void stream_flush_stream( struct stream_impl_seq *si ) @@ -646,10 +646,6 @@ static void stream_close_stream( struct stream_impl_seq *si ) static void stream_print_tree( struct colm_program *prg, tree_t **sp, struct stream_impl_seq *si, tree_t *tree, int trim ) { - if ( si->file != 0 ) - colm_print_tree_file( prg, sp, (struct stream_impl*)si, tree, false ); - else if ( si->collect != 0 ) - colm_print_tree_collect( prg, sp, si->collect, tree, false ); } static int stream_get_parse_block( struct stream_impl_seq *is, int skip, char **pdp, int *copied ) @@ -1284,21 +1280,21 @@ static struct stream_impl *colm_impl_new_text( char *name, const char *data, int return (struct stream_impl*)si; } -struct stream_impl *colm_impl_new_generic( char *name ) +struct stream_impl *colm_impl_new_collect( char *name ) { - struct stream_impl_seq *ss = (struct stream_impl_seq*)malloc(sizeof(struct stream_impl_seq)); - init_stream_impl_seq( ss, name ); - ss->funcs = (struct stream_funcs*)&stream_funcs; + struct stream_impl_data *ss = (struct stream_impl_data*)malloc(sizeof(struct stream_impl_data)); + init_stream_impl_data( ss, name ); + ss->funcs = (struct stream_funcs*)&text_funcs; + ss->collect = (struct colm_str_collect*) malloc( sizeof( struct colm_str_collect ) ); + init_str_collect( ss->collect ); return (struct stream_impl*)ss; } -struct stream_impl *colm_impl_new_collect( char *name ) +struct stream_impl *colm_impl_new_generic( char *name ) { struct stream_impl_seq *ss = (struct stream_impl_seq*)malloc(sizeof(struct stream_impl_seq)); init_stream_impl_seq( ss, name ); ss->funcs = (struct stream_funcs*)&stream_funcs; - ss->collect = (struct colm_str_collect*) malloc( sizeof( struct colm_str_collect ) ); - init_str_collect( ss->collect ); return (struct stream_impl*)ss; } |