summaryrefslogtreecommitdiff
path: root/src/structs.h
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-13 23:23:53 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-13 23:23:53 +0100
commit7707344ddec9069b495b2a5ed41f2104466fc88b (patch)
tree9c6b21f811c7c38a89daf010c61453d7d6eaa8da /src/structs.h
parente516c39ee97cb85fa230fbb1b1f54ad1346920d9 (diff)
downloadvim-git-7707344ddec9069b495b2a5ed41f2104466fc88b.tar.gz
patch 7.4.1315v7.4.1315
Problem: Using a channel handle does not allow for freeing it when unused. Solution: Add the Channel variable type.
Diffstat (limited to 'src/structs.h')
-rw-r--r--src/structs.h42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/structs.h b/src/structs.h
index 65900e424..c8334cbea 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -1127,7 +1127,8 @@ typedef enum
VAR_DICT, /* "v_dict" is used */
VAR_FLOAT, /* "v_float" is used */
VAR_SPECIAL, /* "v_number" is used */
- VAR_JOB /* "v_job" is used */
+ VAR_JOB, /* "v_job" is used */
+ VAR_CHANNEL /* "v_channel" is used */
} vartype_T;
/*
@@ -1149,6 +1150,9 @@ typedef struct
#ifdef FEAT_JOB
job_T *v_job; /* job value (can be NULL!) */
#endif
+#ifdef FEAT_CHANNEL
+ channel_T *v_channel; /* channel value (can be NULL!) */
+#endif
} vval;
} typval_T;
@@ -1260,7 +1264,7 @@ struct jobvar_S
jobstatus_T jv_status;
int jv_refcount; /* reference count */
- int jv_channel; /* channel for I/O */
+ channel_T *jv_channel; /* channel for I/O, reference counted */
};
/*
@@ -1268,35 +1272,41 @@ struct jobvar_S
*/
struct readq_S
{
- char_u *buffer;
- readq_T *next;
- readq_T *prev;
+ char_u *rq_buffer;
+ readq_T *rq_next;
+ readq_T *rq_prev;
};
struct jsonq_S
{
- typval_T *value;
- jsonq_T *next;
- jsonq_T *prev;
+ typval_T *jq_value;
+ jsonq_T *jq_next;
+ jsonq_T *jq_prev;
};
struct cbq_S
{
- char_u *callback;
- int seq_nr;
- cbq_T *next;
- cbq_T *prev;
+ char_u *cq_callback;
+ int cq_seq_nr;
+ cbq_T *cq_next;
+ cbq_T *cq_prev;
};
/* mode for a channel */
typedef enum
{
- MODE_RAW = 0,
+ MODE_NL = 0,
+ MODE_RAW,
MODE_JSON,
MODE_JS
} ch_mode_T;
struct channel_S {
+ channel_T *ch_next;
+ channel_T *ch_prev;
+
+ int ch_id; /* ID of the channel */
+
sock_T ch_sock; /* the socket, -1 for a closed channel */
#ifdef UNIX
@@ -1342,7 +1352,11 @@ struct channel_S {
int ch_timeout; /* request timeout in msec */
- job_T *ch_job; /* job that uses this channel */
+ job_T *ch_job; /* Job that uses this channel; this does not
+ * count as a reference to avoid a circular
+ * reference. */
+
+ int ch_refcount; /* reference count */
};