diff options
author | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-05-31 13:34:41 +0200 |
---|---|---|
committer | Nicolas Hillegeer <nicolas@hillegeer.com> | 2014-06-08 19:21:35 +0200 |
commit | 54ca93465c9ecb3490da12478be48718820e3542 (patch) | |
tree | 6e2a452a33275477468368f8d0f087ad57100b5c /src/nvim/api/vim.c | |
parent | 563698b2dc3f280b6d0d1e9156d0f1d4a4f756c4 (diff) | |
download | rneovim-54ca93465c9ecb3490da12478be48718820e3542.tar.gz rneovim-54ca93465c9ecb3490da12478be48718820e3542.tar.bz2 rneovim-54ca93465c9ecb3490da12478be48718820e3542.zip |
api: unify string conversions, simplify interop
- The data member of String's can now be passed directly to functions
expecting C strings, as we now guarantee that they are NUL-terminated.
This obviates the need to use xstrndup and free, simplifying code and
enhancing performance.
- Use xmemdupz instead of xstrndup for converting String's into C strings.
It's faster because it doesn't calculate strlen(string.data) (which is
unnecesary as that information is already provided in string.size anyway).
- Use cstr_to_string to convert from C strings to String, it is both shorter
and faster than the usual strlen/xstrndup combo, which calls strlen twice.
cstr_to_string internally calls strlen and then xmemdupz.
Diffstat (limited to 'src/nvim/api/vim.c')
0 files changed, 0 insertions, 0 deletions