patch 7.4.1356
Problem: Job and channel options parsing is scattered.
Solution: Move all option value parsing to get_job_options();
diff --git a/src/channel.c b/src/channel.c
index 561a9e5..cd0c584 100644
--- a/src/channel.c
+++ b/src/channel.c
@@ -749,24 +749,6 @@
}
/*
- * Set the mode of channel "channel" to "mode".
- */
- void
-channel_set_mode(channel_T *channel, ch_mode_T mode)
-{
- channel->ch_mode = mode;
-}
-
-/*
- * Set the read timeout of channel "channel".
- */
- void
-channel_set_timeout(channel_T *channel, int timeout)
-{
- channel->ch_timeout = timeout;
-}
-
-/*
* Set the callback for channel "channel".
*/
void
@@ -782,9 +764,13 @@
void
channel_set_options(channel_T *channel, jobopt_T *options)
{
- channel_set_mode(channel, options->jo_mode);
+ if (options->jo_set & JO_MODE)
+ channel->ch_mode = options->jo_mode;
+ if (options->jo_set & JO_TIMEOUT)
+ channel->ch_timeout = options->jo_timeout;
- if (options->jo_callback != NULL && *options->jo_callback != NUL)
+ if ((options->jo_set & JO_CALLBACK)
+ && options->jo_callback != NULL && *options->jo_callback != NUL)
channel_set_callback(channel, options->jo_callback);
}