diff options
author | 2014-03-15 19:49:55 -0700 | |
---|---|---|
committer | 2014-03-15 19:49:55 -0700 | |
commit | 73c2846d64216b42064bc4a42f6e779831a8e9e6 (patch) | |
tree | 0d84560b3daa5518adfbf68e4b4446ad706b76a2 | |
parent | acd203840720897d015b7f5f4e8e71927e667da2 (diff) |
Remove support for input IO_BUFFERs, which were only used by fish_pager
-rw-r--r-- | exec.cpp | 6 | ||||
-rw-r--r-- | fish_tests.cpp | 2 | ||||
-rw-r--r-- | io.cpp | 9 | ||||
-rw-r--r-- | io.h | 16 | ||||
-rw-r--r-- | reader.cpp | 9 |
5 files changed, 13 insertions, 29 deletions
@@ -929,7 +929,7 @@ void exec_job(parser_t &parser, job_t *j) if (p->next) { // Be careful to handle failure, e.g. too many open fds - block_output_io_buffer.reset(io_buffer_t::create(false /* = not input */, STDOUT_FILENO)); + block_output_io_buffer.reset(io_buffer_t::create(STDOUT_FILENO)); if (block_output_io_buffer.get() == NULL) { exec_error = true; @@ -958,7 +958,7 @@ void exec_job(parser_t &parser, job_t *j) { if (p->next) { - block_output_io_buffer.reset(io_buffer_t::create(0)); + block_output_io_buffer.reset(io_buffer_t::create(STDOUT_FILENO)); if (block_output_io_buffer.get() == NULL) { /* We failed (e.g. no more fds could be created). */ @@ -1606,7 +1606,7 @@ static int exec_subshell_internal(const wcstring &cmd, wcstring_list_t *lst, boo int subcommand_status = -1; //assume the worst // IO buffer creation may fail (e.g. if we have too many open files to make a pipe), so this may be null - const shared_ptr<io_buffer_t> io_buffer(io_buffer_t::create(0)); + const shared_ptr<io_buffer_t> io_buffer(io_buffer_t::create(STDOUT_FILENO)); if (io_buffer.get() != NULL) { parser_t &parser = parser_t::principal_parser(); diff --git a/fish_tests.cpp b/fish_tests.cpp index 7e82193c..5b7bcea6 100644 --- a/fish_tests.cpp +++ b/fish_tests.cpp @@ -638,7 +638,7 @@ static int signal_main(test_cancellation_info_t *info) static void test_1_cancellation(const wchar_t *src) { - shared_ptr<io_buffer_t> out_buff(io_buffer_t::create(false, STDOUT_FILENO)); + shared_ptr<io_buffer_t> out_buff(io_buffer_t::create(STDOUT_FILENO)); const io_chain_t io_chain(out_buff); test_cancellation_info_t ctx = {pthread_self(), 0.25 /* seconds */ }; iothread_perform(signal_main, (void (*)(test_cancellation_info_t *, int))NULL, &ctx); @@ -123,14 +123,11 @@ void io_buffer_t::read() } -io_buffer_t *io_buffer_t::create(bool is_input, int fd) +io_buffer_t *io_buffer_t::create(int fd) { bool success = true; - if (fd == -1) - { - fd = is_input ? STDIN_FILENO : STDOUT_FILENO; - } - io_buffer_t *buffer_redirect = new io_buffer_t(fd, is_input); + assert(fd >= 0); + io_buffer_t *buffer_redirect = new io_buffer_t(fd); if (exec_pipe(buffer_redirect->pipe_fd) == -1) { @@ -131,8 +131,8 @@ private: /** buffer to save output in */ std::vector<char> out_buffer; - io_buffer_t(int f, bool i): - io_pipe_t(IO_BUFFER, f, i), + io_buffer_t(int f): + io_pipe_t(IO_BUFFER, f, false /* not input */), out_buffer() { } @@ -172,16 +172,12 @@ public: /** Create a IO_BUFFER type io redirection, complete with a pipe and a - vector<char> for output. The default file descriptor used is 1 for - output buffering and 0 for input buffering. + vector<char> for output. The default file descriptor used is STDOUT_FILENO + for buffering - \param is_input set this parameter to zero if the buffer should be - used to buffer the output of a command, or non-zero to buffer the - input to a command. - - \param fd when -1, determined from is_input. + \param fd the fd that will be mapped in the child process, typically STDOUT_FILENO */ - static io_buffer_t *create(bool is_input, int fd = -1); + static io_buffer_t *create(int fd); }; class io_chain_t : public std::vector<shared_ptr<io_data_t> > @@ -586,15 +586,6 @@ static void reader_repaint() data->repaint_needed = false; } -static void reader_repaint_without_autosuggestion() -{ - // Swap in an empty autosuggestion, repaint, then swap it out - wcstring saved_autosuggestion; - data->autosuggestion.swap(saved_autosuggestion); - reader_repaint(); - data->autosuggestion.swap(saved_autosuggestion); -} - /** Internal helper function for handling killing parts of text. */ static void reader_kill(editable_line_t *el, size_t begin_idx, size_t length, int mode, int newv) { |