diff options
author | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-09-26 05:48:04 +0000 |
---|---|---|
committer | Kovarththanan Rajaratnam <kovarththanan.rajaratnam@gmail.com> | 2009-09-26 05:48:04 +0000 |
commit | f4db31c8d8eb1b07817a756168691b8d7d0eec20 (patch) | |
tree | 5b586203624476a936bc7eff1c129c686c447237 /print.c | |
parent | a46d38a07da451ba05cc40853f76b03976a5e31f (diff) | |
download | wireshark-f4db31c8d8eb1b07817a756168691b8d7d0eec20.tar.gz |
Introduce print_stream_ps_alloc() and start using it
svn path=/trunk/; revision=30164
Diffstat (limited to 'print.c')
-rw-r--r-- | print.c | 31 |
1 files changed, 14 insertions, 17 deletions
@@ -1209,17 +1209,12 @@ static const print_stream_ops_t print_ps_ops = { destroy_ps }; -print_stream_t * -print_stream_ps_new(int to_file, const char *dest) +static print_stream_t * +print_stream_ps_alloc(int to_file, FILE *fh) { - FILE *fh; print_stream_t *stream; output_ps *output; - fh = open_print_dest(to_file, dest); - if (fh == NULL) - return NULL; - output = g_malloc(sizeof *output); output->to_file = to_file; output->fh = fh; @@ -1231,19 +1226,21 @@ print_stream_ps_new(int to_file, const char *dest) } print_stream_t * -print_stream_ps_stdio_new(FILE *fh) +print_stream_ps_new(int to_file, const char *dest) { - print_stream_t *stream; - output_ps *output; + FILE *fh; - output = g_malloc(sizeof *output); - output->to_file = TRUE; - output->fh = fh; - stream = g_malloc(sizeof (print_stream_t)); - stream->ops = &print_ps_ops; - stream->data = output; + fh = open_print_dest(to_file, dest); + if (fh == NULL) + return NULL; - return stream; + return print_stream_ps_alloc(to_file, fh); +} + +print_stream_t * +print_stream_ps_stdio_new(FILE *fh) +{ + return print_stream_ps_alloc(TRUE, fh); } output_fields_t* output_fields_new() |