summaryrefslogtreecommitdiffstats
path: root/src/dict.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-06-16 22:54:14 +0200
committerBram Moolenaar <Bram@vim.org>2019-06-16 22:54:14 +0200
commitae943150d3a2868a89df802c9f530331474451ec (patch)
tree26ba407cb4f856dace31834fbf9fdcef0dd95f0b /src/dict.c
parent6313c4f41d0e1d91b4217557685c014ea919915f (diff)
patch 8.1.1561: popup_setoptions() is not implemented yetv8.1.1561
Problem: Popup_setoptions() is not implemented yet. Solution: Implement popup_setoptions(). Also add more fields to popup_getoptions().
Diffstat (limited to 'src/dict.c')
-rw-r--r--src/dict.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/dict.c b/src/dict.c
index c67eb42c58..ffcb100624 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -448,6 +448,27 @@ dict_add_list(dict_T *d, char *key, list_T *list)
}
/*
+ * Add a callback to dictionary "d".
+ * Returns FAIL when out of memory and when key already exists.
+ */
+ int
+dict_add_callback(dict_T *d, char *key, callback_T *cb)
+{
+ dictitem_T *item;
+
+ item = dictitem_alloc((char_u *)key);
+ if (item == NULL)
+ return FAIL;
+ put_callback(cb, &item->di_tv);
+ if (dict_add(d, item) == FAIL)
+ {
+ dictitem_free(item);
+ return FAIL;
+ }
+ return OK;
+}
+
+/*
* Initializes "iter" for iterating over dictionary items with
* dict_iterate_next().
* If "var" is not a Dict or an empty Dict then there will be nothing to