diff options
| author | bfredl <bjorn.linse@gmail.com> | 2024-02-09 11:42:40 +0100 |
|---|---|---|
| committer | bfredl <bjorn.linse@gmail.com> | 2024-02-09 15:11:21 +0100 |
| commit | e0e5b7f0ba1b0440bdc2b557e2b2cfae24706cbd (patch) | |
| tree | e323ac2fd3a1dc9619265f7daa069ba9a66d8f2b /src/nvim/api/private | |
| parent | 4788abf2da6bb5c37e880d74a73a4a7de736b6ac (diff) | |
| download | rneovim-e0e5b7f0ba1b0440bdc2b557e2b2cfae24706cbd.tar.gz rneovim-e0e5b7f0ba1b0440bdc2b557e2b2cfae24706cbd.tar.bz2 rneovim-e0e5b7f0ba1b0440bdc2b557e2b2cfae24706cbd.zip | |
refactor(api): make cstr_as_string accept "const char*"
In the context a String inside an Object/Dictionary etc is consumed,
it is considered to be read-only.
Diffstat (limited to 'src/nvim/api/private')
| -rw-r--r-- | src/nvim/api/private/helpers.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/nvim/api/private/helpers.c b/src/nvim/api/private/helpers.c index cc95f46baf..8b45af7c71 100644 --- a/src/nvim/api/private/helpers.c +++ b/src/nvim/api/private/helpers.c @@ -425,12 +425,12 @@ String cstrn_as_string(char *str, size_t maxsize) /// @param str the C string to use /// @return The resulting String, or an empty String if /// str was NULL -String cstr_as_string(char *str) FUNC_ATTR_PURE +String cstr_as_string(const char *str) FUNC_ATTR_PURE { if (str == NULL) { return (String)STRING_INIT; } - return (String){ .data = str, .size = strlen(str) }; + return (String){ .data = (char *)str, .size = strlen(str) }; } /// Return the owned memory of a ga as a String |