From b92abad0c58de36d0b0afdcd4ec05261fa1fa84c Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 8 Feb 2016 22:37:24 +0100 Subject: [PATCH 1/3] patch 7.4.1291 Problem: On MS-Windows the channel test server doesn't quit. Solution: Use return instead of break. (Ken Takata) --- src/testdir/test_channel.py | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/testdir/test_channel.py b/src/testdir/test_channel.py index 40a2043cc0..039a9de91e 100644 --- a/src/testdir/test_channel.py +++ b/src/testdir/test_channel.py @@ -133,7 +133,7 @@ class ThreadedTCPRequestHandler(socketserver.BaseRequestHandler): elif decoded[1] == '!quit!': # we're done self.server.shutdown() - break + return elif decoded[1] == '!crash!': # Crash! 42 / 0 diff --git a/src/version.c b/src/version.c index 66739aa29d..9b9702aa27 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1291, /**/ 1290, /**/ From 2fc83fcd1d6dfd4728a2ef70e2316f79203c7ee0 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 8 Feb 2016 22:57:24 +0100 Subject: [PATCH 2/3] patch 7.4.1292 Problem: Some compilers complain about uninitialzed variable, even though all possible cases are handled. (Dominique Pelle) Solution: Add a default initialization. --- src/eval.c | 6 +++--- src/version.c | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/eval.c b/src/eval.c index b544fc3495..33f95ef30b 100644 --- a/src/eval.c +++ b/src/eval.c @@ -10611,7 +10611,7 @@ f_diff_hlID(typval_T *argvars UNUSED, typval_T *rettv UNUSED) static void f_empty(typval_T *argvars, typval_T *rettv) { - int n; + int n = FALSE; switch (argvars[0].v_type) { @@ -19935,7 +19935,7 @@ f_trunc(typval_T *argvars, typval_T *rettv) static void f_type(typval_T *argvars, typval_T *rettv) { - int n; + int n = -1; switch (argvars[0].v_type) { @@ -24952,7 +24952,7 @@ write_viminfo_varlist(FILE *fp) hashitem_T *hi; dictitem_T *this_var; int todo; - char *s; + char *s = ""; char_u *p; char_u *tofree; char_u numbuf[NUMBUFLEN]; diff --git a/src/version.c b/src/version.c index 9b9702aa27..d9f0807191 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1292, /**/ 1291, /**/ From e56bf15c163a921ce9e1c09c0d5b3a03efc63324 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Mon, 8 Feb 2016 23:23:42 +0100 Subject: [PATCH 3/3] patch 7.4.1293 Problem: Sometimes a channel may hang waiting for a message that was already discarded. (Ken Takata) Solution: Store the ID of the message blocking on in the channel. --- src/channel.c | 26 ++++++++++++++++++-------- src/version.c | 2 ++ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/channel.c b/src/channel.c index 5e4d1825c3..50dd18087c 100644 --- a/src/channel.c +++ b/src/channel.c @@ -116,6 +116,8 @@ typedef struct { void (*ch_close_cb)(void); /* callback for when channel is closed */ + int ch_block_id; /* ID that channel_read_json_block() is + waiting for */ char_u *ch_callback; /* function to call when a msg is not handled */ cbq_T ch_cb_head; /* dummy node for pre-request callbacks */ @@ -765,15 +767,17 @@ remove_json_node(jsonq_T *node) /* * Get a message from the JSON queue for channel "ch_idx". * When "id" is positive it must match the first number in the list. - * When "id" is zero or negative jut get the first message. + * When "id" is zero or negative jut get the first message. But not the one + * with id ch_block_id. * Return OK when found and return the value in "rettv". * Return FAIL otherwise. */ static int channel_get_json(int ch_idx, int id, typval_T **rettv) { - jsonq_T *head = &channels[ch_idx].ch_json_head; - jsonq_T *item = head->next; + channel_T *channel = &channels[ch_idx]; + jsonq_T *head = &channel->ch_json_head; + jsonq_T *item = head->next; while (item != head) { @@ -781,7 +785,8 @@ channel_get_json(int ch_idx, int id, typval_T **rettv) typval_T *tv = &l->lv_first->li_tv; if ((id > 0 && tv->v_type == VAR_NUMBER && tv->vval.v_number == id) - || id <= 0) + || (id <= 0 && (tv->v_type != VAR_NUMBER + || tv->vval.v_number != channel->ch_block_id))) { *rettv = item->value; remove_json_node(item); @@ -1291,15 +1296,20 @@ channel_read_block(int idx) int channel_read_json_block(int ch_idx, int id, typval_T **rettv) { - int more; + int more; + channel_T *channel = &channels[ch_idx]; + channel->ch_block_id = id; for (;;) { more = channel_parse_json(ch_idx); /* search for messsage "id" */ if (channel_get_json(ch_idx, id, rettv) == OK) + { + channel->ch_block_id = 0; return OK; + } if (!more) { @@ -1309,13 +1319,13 @@ channel_read_json_block(int ch_idx, int id, typval_T **rettv) continue; /* Wait for up to the channel timeout. */ - if (channels[ch_idx].ch_fd < 0 - || channel_wait(channels[ch_idx].ch_fd, - channels[ch_idx].ch_timeout) == FAIL) + if (channel->ch_fd < 0 || channel_wait(channel->ch_fd, + channel->ch_timeout) == FAIL) break; channel_read(ch_idx); } } + channel->ch_block_id = 0; return FAIL; } diff --git a/src/version.c b/src/version.c index d9f0807191..b5bf05ea0f 100644 --- a/src/version.c +++ b/src/version.c @@ -747,6 +747,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1293, /**/ 1292, /**/