diff options
author | Bram Moolenaar <Bram@vim.org> | 2016-03-11 22:52:15 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2016-03-11 22:52:15 +0100 |
commit | 509ce2a558e7e0c03242e32e844255af52f1c821 (patch) | |
tree | a79ac8c1e42f2f9eefa81016328194a346dade06 /src/channel.c | |
parent | de27989157f35172b25f9e01e0c147ed8f6ae3ce (diff) | |
download | vim-509ce2a558e7e0c03242e32e844255af52f1c821.zip |
patch 7.4.1537
Problem: Too many feature flags for pipes, jobs and channels.
Solution: Only use FEAT_JOB_CHANNEL.
Diffstat (limited to 'src/channel.c')
-rw-r--r-- | src/channel.c | 81 |
1 files changed, 6 insertions, 75 deletions
diff --git a/src/channel.c b/src/channel.c index f65b31fb1..e17fc5207 100644 --- a/src/channel.c +++ b/src/channel.c @@ -12,7 +12,7 @@ #include "vim.h" -#if defined(FEAT_CHANNEL) || defined(PROTO) +#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) /* TRUE when netbeans is running with a GUI. */ #ifdef FEAT_GUI @@ -294,11 +294,7 @@ add_channel(void) channel->ch_id = next_ch_id++; ch_log(channel, "Created channel"); -#ifdef CHANNEL_PIPES for (part = PART_SOCK; part <= PART_IN; ++part) -#else - part = PART_SOCK; -#endif { channel->ch_part[part].ch_fd = INVALID_FD; #ifdef FEAT_GUI_X11 @@ -330,10 +326,8 @@ add_channel(void) channel_still_useful(channel_T *channel) { int has_sock_msg; -#ifdef CHANNEL_PIPES int has_out_msg; int has_err_msg; -#endif /* If the job was killed the channel is not expected to work anymore. */ if (channel->ch_job_killed && channel->ch_job == NULL) @@ -348,24 +342,16 @@ channel_still_useful(channel_T *channel) has_sock_msg = channel->ch_part[PART_SOCK].ch_fd != INVALID_FD || channel->ch_part[PART_SOCK].ch_head.rq_next != NULL || channel->ch_part[PART_SOCK].ch_json_head.jq_next != NULL; -#ifdef CHANNEL_PIPES has_out_msg = channel->ch_part[PART_OUT].ch_fd != INVALID_FD || channel->ch_part[PART_OUT].ch_head.rq_next != NULL || channel->ch_part[PART_OUT].ch_json_head.jq_next != NULL; has_err_msg = channel->ch_part[PART_ERR].ch_fd != INVALID_FD || channel->ch_part[PART_ERR].ch_head.rq_next != NULL || channel->ch_part[PART_ERR].ch_json_head.jq_next != NULL; -#endif return (channel->ch_callback != NULL && (has_sock_msg -#ifdef CHANNEL_PIPES - || has_out_msg || has_err_msg -#endif - )) -#ifdef CHANNEL_PIPES + || has_out_msg || has_err_msg)) || (channel->ch_part[PART_OUT].ch_callback != NULL && has_out_msg) - || (channel->ch_part[PART_ERR].ch_callback != NULL && has_err_msg) -#endif - ; + || (channel->ch_part[PART_ERR].ch_callback != NULL && has_err_msg); } /* @@ -507,12 +493,10 @@ channel_gui_register(channel_T *channel) { if (channel->CH_SOCK_FD != INVALID_FD) channel_gui_register_one(channel, PART_SOCK); -# ifdef CHANNEL_PIPES if (channel->CH_OUT_FD != INVALID_FD) channel_gui_register_one(channel, PART_OUT); if (channel->CH_ERR_FD != INVALID_FD) channel_gui_register_one(channel, PART_ERR); -# endif } /* @@ -557,14 +541,8 @@ channel_gui_unregister(channel_T *channel) { int part; -#ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -#else - part = PART_SOCK; -#endif - { channel_gui_unregister_one(channel, part); - } } #endif @@ -842,7 +820,6 @@ channel_open( return channel; } -#if defined(CHANNEL_PIPES) || defined(PROTO) static void may_close_part(sock_T *fd) { @@ -884,7 +861,6 @@ channel_set_pipes(channel_T *channel, sock_T in, sock_T out, sock_T err) # endif } } -#endif /* * Sets the job the channel is associated with and associated options. @@ -1897,10 +1873,7 @@ may_invoke_callback(channel_T *channel, int part) channel_can_write_to(channel_T *channel) { return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD -#ifdef CHANNEL_PIPES - || channel->CH_IN_FD != INVALID_FD -#endif - ); + || channel->CH_IN_FD != INVALID_FD); } /* @@ -1911,12 +1884,9 @@ channel_can_write_to(channel_T *channel) channel_is_open(channel_T *channel) { return channel != NULL && (channel->CH_SOCK_FD != INVALID_FD -#ifdef CHANNEL_PIPES || channel->CH_IN_FD != INVALID_FD || channel->CH_OUT_FD != INVALID_FD - || channel->CH_ERR_FD != INVALID_FD -#endif - ); + || channel->CH_ERR_FD != INVALID_FD); } /* @@ -1951,11 +1921,9 @@ channel_close(channel_T *channel, int invoke_close_cb) sock_close(channel->CH_SOCK_FD); channel->CH_SOCK_FD = INVALID_FD; } -#if defined(CHANNEL_PIPES) may_close_part(&channel->CH_IN_FD); may_close_part(&channel->CH_OUT_FD); may_close_part(&channel->CH_ERR_FD); -#endif if (invoke_close_cb && channel->ch_close_cb != NULL) { @@ -2036,10 +2004,8 @@ channel_clear(channel_T *channel) { ch_log(channel, "Clearing channel"); channel_clear_one(channel, PART_SOCK); -#ifdef CHANNEL_PIPES channel_clear_one(channel, PART_OUT); channel_clear_one(channel, PART_ERR); -#endif vim_free(channel->ch_callback); channel->ch_callback = NULL; vim_free(channel->ch_close_cb); @@ -2357,11 +2323,7 @@ channel_fd2channel(sock_T fd, int *partp) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif if (channel->ch_part[part].ch_fd == fd) { *partp = part; @@ -2386,13 +2348,8 @@ channel_handle_events(void) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES /* check the socket and pipes */ for (part = PART_SOCK; part <= PART_ERR; ++part) -# else - /* only check the socket */ - part = PART_SOCK; -# endif { fd = channel->ch_part[part].ch_fd; if (fd != INVALID_FD && channel_wait(channel, fd, 0) == OK) @@ -2471,11 +2428,7 @@ channel_poll_setup(int nfd_in, void *fds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { if (channel->ch_part[part].ch_fd != INVALID_FD) { @@ -2505,11 +2458,7 @@ channel_poll_check(int ret_in, void *fds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { int idx = channel->ch_part[part].ch_poll_idx; @@ -2539,11 +2488,7 @@ channel_select_setup(int maxfd_in, void *rfds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { sock_T fd = channel->ch_part[part].ch_fd; @@ -2572,11 +2517,7 @@ channel_select_check(int ret_in, void *rfds_in) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -# ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -# else - part = PART_SOCK; -# endif { sock_T fd = channel->ch_part[part].ch_fd; @@ -2657,11 +2598,9 @@ channel_parse_messages(void) continue; } } -#ifdef CHANNEL_PIPES if (part < PART_ERR) ++part; else -#endif { channel = channel->ch_next; part = PART_SOCK; @@ -2692,11 +2631,7 @@ set_ref_in_channel(int copyID) for (channel = first_channel; channel != NULL; channel = channel->ch_next) { -#ifdef CHANNEL_PIPES for (part = PART_SOCK; part < PART_IN; ++part) -#else - part = PART_SOCK; -#endif { jsonq_T *head = &channel->ch_part[part].ch_json_head; jsonq_T *item = head->jq_next; @@ -2723,10 +2658,8 @@ set_ref_in_channel(int copyID) int channel_part_send(channel_T *channel) { -#ifdef CHANNEL_PIPES if (channel->CH_SOCK_FD == INVALID_FD) return PART_IN; -#endif return PART_SOCK; } @@ -2736,10 +2669,8 @@ channel_part_send(channel_T *channel) int channel_part_read(channel_T *channel) { -#ifdef CHANNEL_PIPES if (channel->CH_SOCK_FD == INVALID_FD) return PART_OUT; -#endif return PART_SOCK; } @@ -2764,4 +2695,4 @@ channel_get_timeout(channel_T *channel, int part) return channel->ch_part[part].ch_timeout; } -#endif /* FEAT_CHANNEL */ +#endif /* FEAT_JOB_CHANNEL */ |