summaryrefslogtreecommitdiff
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-08-12 22:23:25 +0200
committerBram Moolenaar <Bram@vim.org>2016-08-12 22:23:25 +0200
commitb5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f (patch)
tree4102b935644caa2544138f3abb1d038523568d94 /src/dict.c
parentebcccad573a7722e16cf2dd435cc62b61f61d9cc (diff)
downloadvim-git-b5ae48e9ffd3b8eb6ca4057de11f1bddcde8ce6f.tar.gz
patch 7.4.2204v7.4.2204
Problem: It is not easy to get information about buffers, windows and tabpages. Solution: Add getbufinfo(), getwininfo() and gettabinfo(). (Yegappan Lakshmanan)
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index 30a15a6f0..d78d42d52 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -367,6 +367,30 @@ dict_add_list(dict_T *d, char *key, list_T *list)
}
/*
+ * Add a dict entry to dictionary "d".
+ * Returns FAIL when out of memory and when key already exists.
+ */
+ int
+dict_add_dict(dict_T *d, char *key, dict_T *dict)
+{
+ dictitem_T *item;
+
+ item = dictitem_alloc((char_u *)key);
+ if (item == NULL)
+ return FAIL;
+ item->di_tv.v_lock = 0;
+ item->di_tv.v_type = VAR_DICT;
+ item->di_tv.vval.v_dict = dict;
+ if (dict_add(d, item) == FAIL)
+ {
+ dictitem_free(item);
+ return FAIL;
+ }
+ ++dict->dv_refcount;
+ return OK;
+}
+
+/*
* Get the number of items in a Dictionary.
*/
long