]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 7.4.1623 v7.4.1623
authorBram Moolenaar <Bram@vim.org>
Sun, 20 Mar 2016 18:31:33 +0000 (19:31 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 20 Mar 2016 18:31:33 +0000 (19:31 +0100)
Problem:    All Channels share the message ID, it keeps getting bigger.
Solution:   Use a message ID per channel.

src/channel.c
src/proto/channel.pro
src/structs.h
src/version.c

index 7fe68d5b4538b36912580e4c2f50abc6e99507c4..15c7c74d01fcd4ef21cb324ab37e734ed20454ee 100644 (file)
@@ -2294,17 +2294,6 @@ channel_wait(channel_T *channel, sock_T fd, int timeout)
     return FAIL;
 }
 
-/*
- * 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.
@@ -2787,7 +2776,7 @@ ch_expr_common(typval_T *argvars, typval_T *rettv, int eval)
        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)
index be11a3ad20174680f785a0a023a664afd0fe1cad..b98fb5801771958d64df8b62ebae41ff39e563ed 100644 (file)
@@ -24,10 +24,9 @@ void channel_close(channel_T *channel, int invoke_close_cb);
 char_u *channel_peek(channel_T *channel, int part);
 void channel_clear(channel_T *channel);
 void channel_free_all(void);
-int channel_get_id(void);
 void channel_read(channel_T *channel, int part, char *func);
 char_u *channel_read_block(channel_T *channel, int part, int timeout);
-int channel_read_json_block(channel_T *channel, int part, int timeout, int id, typval_T **rettv);
+int channel_read_json_block(channel_T *channel, int part, int timeout_arg, int id, typval_T **rettv);
 void common_channel_read(typval_T *argvars, typval_T *rettv, int raw);
 channel_T *channel_fd2channel(sock_T fd, int *partp);
 void channel_handle_events(void);
index 470beff3c5db702532acb3f6dcabb00b6d5eb951..85223a0ce55f122158306f46a1d2a2e62814481c 100644 (file)
@@ -1380,6 +1380,7 @@ struct channel_S {
     channel_T  *ch_prev;
 
     int                ch_id;          /* ID of the channel */
+    int                ch_last_msg_id; /* ID of the last message */
 
     chanpart_T ch_part[4];     /* info for socket, out, err and in */
 
index 8d4fee47eddeb800127ac5e01889137e4d395dee..d7277034ac812cca7b4e3650b89025b5154e19cb 100644 (file)
@@ -748,6 +748,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1623,
 /**/
     1622,
 /**/