diff src/channel.c @ 8667:8c80c21a1885 v7.4.1623

commit https://github.com/vim/vim/commit/e9d6a298df6108e2044b1f0da5a2712f0c51c7d9 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Mar 20 19:31:33 2016 +0100 patch 7.4.1623 Problem: All Channels share the message ID, it keeps getting bigger. Solution: Use a message ID per channel.
author Christian Brabandt <cb@256bit.org>
date Sun, 20 Mar 2016 19:45:04 +0100
parents c70eea7a7677
children 06848fe9c816
line wrap: on
line diff
--- a/src/channel.c
+++ b/src/channel.c
@@ -2295,17 +2295,6 @@ channel_wait(channel_T *channel, sock_T 
 }
 
 /*
- * Return a unique ID to be used in a message.
- */
-    int
-channel_get_id(void)
-{
-    static int next_id = 1;
-
-    return next_id++;
-}
-
-/*
  * Read from channel "channel" for as long as there is something to read.
  * "part" is PART_SOCK, PART_OUT or PART_ERR.
  * The data is put in the read queue.
@@ -2787,7 +2776,7 @@ ch_expr_common(typval_T *argvars, typval
 	return;
     }
 
-    id = channel_get_id();
+    id = ++channel->ch_last_msg_id;
     text = json_encode_nr_expr(id, &argvars[1],
 					    ch_mode == MODE_JS ? JSON_JS : 0);
     if (text == NULL)