From f1b375b042ad1564d00645579a54bb28ba3e30d1 Mon Sep 17 00:00:00 2001 From: Cheer Xiao Date: Wed, 9 Jan 2013 16:02:04 +0800 Subject: [PATCH] Split out io_close_t --- io.cpp | 8 +++++--- io.h | 11 +++++++++++ parser.cpp | 2 +- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/io.cpp b/io.cpp index 42c55f9fe..33045bcf4 100644 --- a/io.cpp +++ b/io.cpp @@ -67,12 +67,14 @@ void io_data_t::print() const case IO_BUFFER: fprintf(stderr, "buffer %p (size %lu)\n", out_buffer_ptr(), out_buffer_size()); break; - case IO_CLOSE: - fprintf(stderr, "close %d\n", fd); - break; } } +void io_close_t::print() const +{ + fprintf(stderr, "close %d\n", fd); +} + void io_buffer_read(io_data_t *d) { exec_close(d->param1.pipe_fd[1]); diff --git a/io.h b/io.h index da47abe07..d7ddbd0ec 100644 --- a/io.h +++ b/io.h @@ -116,6 +116,17 @@ public: } }; +class io_close_t : public io_data_t +{ +public: + io_close_t(int f) : + io_data_t(IO_CLOSE, f) + { + } + + virtual void print() const; +}; + class io_chain_t : public std::vector > { public: diff --git a/parser.cpp b/parser.cpp index 14ad25c92..1c5f330b2 100644 --- a/parser.cpp +++ b/parser.cpp @@ -1601,7 +1601,7 @@ void parser_t::parse_job_argument_list(process_t *p, { if (target == L"-") { - new_io.reset(new io_data_t(IO_CLOSE, fd)); + new_io.reset(new io_close_t(fd)); } else {