diff src/structs.h @ 15454:1d2b5c016f17 v8.1.0735

patch 8.1.0735: cannot handle binary data commit https://github.com/vim/vim/commit/6e5ea8d2a995b32bbc5972edc4f827b959f2702f Author: Bram Moolenaar <Bram@vim.org> Date: Sat Jan 12 22:47:31 2019 +0100 patch 8.1.0735: cannot handle binary data Problem: Cannot handle binary data. Solution: Add the Blob type. (Yasuhiro Matsumoto, closes https://github.com/vim/vim/issues/3638)
author Bram Moolenaar <Bram@vim.org>
date Sat, 12 Jan 2019 23:00:06 +0100
parents 58b125df3e9b
children 55ccc2d353bd
line wrap: on
line diff
--- a/src/structs.h
+++ b/src/structs.h
@@ -1251,6 +1251,7 @@ typedef double	float_T;
 typedef struct listvar_S list_T;
 typedef struct dictvar_S dict_T;
 typedef struct partial_S partial_T;
+typedef struct blobvar_S blob_T;
 
 typedef struct jobvar_S job_T;
 typedef struct readq_S readq_T;
@@ -1272,6 +1273,7 @@ typedef enum
     VAR_SPECIAL, // "v_number" is used
     VAR_JOB,	 // "v_job" is used
     VAR_CHANNEL, // "v_channel" is used
+    VAR_BLOB,	 // "v_blob" is used
 } vartype_T;
 
 /*
@@ -1295,6 +1297,7 @@ typedef struct
 	job_T		*v_job;		/* job value (can be NULL!) */
 	channel_T	*v_channel;	/* channel value (can be NULL!) */
 #endif
+	blob_T		*v_blob;	/* blob value (can be NULL!) */
     }		vval;
 } typval_T;
 
@@ -1401,6 +1404,16 @@ struct dictvar_S
     dict_T	*dv_used_prev;	/* previous dict in used dicts list */
 };
 
+/*
+ * Structure to hold info about a blob.
+ */
+struct blobvar_S
+{
+    garray_T	bv_ga;		// growarray with the data
+    int		bv_refcount;	// reference count
+    char	bv_lock;	// zero, VAR_LOCKED, VAR_FIXED
+};
+
 #if defined(FEAT_EVAL) || defined(PROTO)
 typedef struct funccall_S funccall_T;
 
@@ -3526,6 +3539,7 @@ typedef struct lval_S
     dict_T	*ll_dict;	/* The Dictionary or NULL */
     dictitem_T	*ll_di;		/* The dictitem or NULL */
     char_u	*ll_newkey;	/* New key for Dict in alloc. mem or NULL. */
+    blob_T	*ll_blob;	/* The Blob or NULL */
 } lval_T;
 
 /* Structure used to save the current state.  Used when executing Normal mode