mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 05:58:33 +00:00
api/msgpack-rpc: Remove specialized array types
Specialized array types(BufferArray, WindowArray, etc) were added to the API for two main reasons: - msgpack used to lack a way of serializing appliaction-specific types and there was no obvious way of making an API function accept/return arrays of custom objects such as buffers(which are represented as integers, so clients didn't have a way to distinguish from normal numbers) - Let clients in statically-typed languages that support generics have a better typed API With msgpack 2.0 EXT type the first item is no longer a factor and this commit starts by removing the specialized array types. The second item will be addressed in the future by making the API metadata return extra useful information for statically-typed languages.
This commit is contained in:
@@ -13,9 +13,9 @@
|
||||
/// @param tabpage The tabpage
|
||||
/// @param[out] err Details of an error that may have occurred
|
||||
/// @return The number of windows in `tabpage`
|
||||
WindowArray tabpage_get_windows(Tabpage tabpage, Error *err)
|
||||
Array tabpage_get_windows(Tabpage tabpage, Error *err)
|
||||
{
|
||||
WindowArray rv = ARRAY_DICT_INIT;
|
||||
Array rv = ARRAY_DICT_INIT;
|
||||
tabpage_T *tab = find_tab_by_handle(tabpage, err);
|
||||
|
||||
if (!tab) {
|
||||
@@ -32,14 +32,14 @@ WindowArray tabpage_get_windows(Tabpage tabpage, Error *err)
|
||||
rv.size++;
|
||||
}
|
||||
|
||||
rv.items = xmalloc(sizeof(Window) * rv.size);
|
||||
rv.items = xmalloc(sizeof(Object) * rv.size);
|
||||
size_t i = 0;
|
||||
|
||||
FOR_ALL_TAB_WINDOWS(tp, wp) {
|
||||
if (tp != tab) {
|
||||
break;
|
||||
}
|
||||
rv.items[i++] = wp->handle;
|
||||
rv.items[i++] = WINDOW_OBJ(wp->handle);
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
Reference in New Issue
Block a user