aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/private/helpers.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2017-05-14 07:43:07 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-05-23 18:18:16 +0200
commit6da4548f0e7ccaf2b3271c0b0d59b5c8869792a7 (patch)
tree7a6e50a3e6ecff85882d91f0a503a212312ee334 /src/nvim/api/private/helpers.c
parentf1bc152fa081f5d630ea1a027aa5bd00bdbb78f0 (diff)
downloadrneovim-6da4548f0e7ccaf2b3271c0b0d59b5c8869792a7.tar.gz
rneovim-6da4548f0e7ccaf2b3271c0b0d59b5c8869792a7.tar.bz2
rneovim-6da4548f0e7ccaf2b3271c0b0d59b5c8869792a7.zip
api: list information about all channels/jobs.
Fire autocmd when channel opens or its info changes. Add a way for API clients can describe themselves.
Diffstat (limited to 'src/nvim/api/private/helpers.c')
-rw-r--r--src/nvim/api/private/helpers.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c
index 17ee3ed711..692a0b51fd 100644
--- a/src/nvim/api/private/helpers.c
+++ b/src/nvim/api/private/helpers.c
@@ -1030,6 +1030,16 @@ Array copy_array(Array array)
return rv;
}
+Dictionary copy_dictionary(Dictionary dict)
+{
+ Dictionary rv = ARRAY_DICT_INIT;
+ for (size_t i = 0; i < dict.size; i++) {
+ KeyValuePair item = dict.items[i];
+ PUT(rv, item.key.data, copy_object(item.value));
+ }
+ return rv;
+}
+
/// Creates a deep clone of an object
Object copy_object(Object obj)
{
@@ -1047,12 +1057,7 @@ Object copy_object(Object obj)
return ARRAY_OBJ(copy_array(obj.data.array));
case kObjectTypeDictionary: {
- Dictionary rv = ARRAY_DICT_INIT;
- for (size_t i = 0; i < obj.data.dictionary.size; i++) {
- KeyValuePair item = obj.data.dictionary.items[i];
- PUT(rv, item.key.data, copy_object(item.value));
- }
- return DICTIONARY_OBJ(rv);
+ return DICTIONARY_OBJ(copy_dictionary(obj.data.dictionary));
}
default:
abort();