diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-02-26 18:00:46 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-02-28 11:00:38 +0100 |
commit | de5cf09cf98e20d8d3296ad6933ff2741acf83f7 (patch) | |
tree | 138b11577f1896643fb593481a41c9b841be6362 /src/nvim/main.c | |
parent | 07b4b7524fc7faefb69e5c94d2512eb0807f0593 (diff) | |
download | rneovim-de5cf09cf98e20d8d3296ad6933ff2741acf83f7.tar.gz rneovim-de5cf09cf98e20d8d3296ad6933ff2741acf83f7.tar.bz2 rneovim-de5cf09cf98e20d8d3296ad6933ff2741acf83f7.zip |
refactor(metadata): generate all metadata in lua
Then we can just load metadata in C as a single msgpack blob. Which also
can be used directly as binarly data, instead of first unpacking all the
functions and ui_events metadata to immediately pack it again, which was
a bit of a silly walk (and one extra usecase of `msgpack_rpc_from_object`
which will get yak shaved in the next PR)
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r-- | src/nvim/main.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c index c2445437e6..6b862f2ed9 100644 --- a/src/nvim/main.c +++ b/src/nvim/main.c @@ -1103,20 +1103,16 @@ static void command_line_scan(mparm_T *parmp) FileDescriptor fp; const int fof_ret = file_open_fd(&fp, STDOUT_FILENO, kFileWriteOnly); - msgpack_packer *p = msgpack_packer_new(&fp, msgpack_file_write); - if (fof_ret != 0) { semsg(_("E5421: Failed to open stdin: %s"), os_strerror(fof_ret)); } - if (p == NULL) { - emsg(_(e_outofmem)); + String data = api_metadata_raw(); + const ptrdiff_t written_bytes = file_write(&fp, data.data, data.size); + if (written_bytes < 0) { + msgpack_file_write_error((int)written_bytes); } - Object md = DICTIONARY_OBJ(api_metadata()); - msgpack_rpc_from_object(&md, p); - - msgpack_packer_free(p); const int ff_ret = file_flush(&fp); if (ff_ret < 0) { msgpack_file_write_error(ff_ret); |