diff options
author | Dundar Goc <gocdundar@gmail.com> | 2022-05-04 18:27:22 +0200 |
---|---|---|
committer | Dundar Goc <gocdundar@gmail.com> | 2022-05-05 18:10:46 +0200 |
commit | 9a671e6a24243a5ff2879599d91ab5aec8b4e77d (patch) | |
tree | 703693c3591ed6b8881ed965f7f2ed2394a29ce6 /src/nvim/eval/encode.c | |
parent | 82c7a82c3585100e73e154c49e3e002b7dc35437 (diff) | |
download | rneovim-9a671e6a24243a5ff2879599d91ab5aec8b4e77d.tar.gz rneovim-9a671e6a24243a5ff2879599d91ab5aec8b4e77d.tar.bz2 rneovim-9a671e6a24243a5ff2879599d91ab5aec8b4e77d.zip |
refactor: replace char_u variables and functions with char
Work on https://github.com/neovim/neovim/issues/459
Diffstat (limited to 'src/nvim/eval/encode.c')
-rw-r--r-- | src/nvim/eval/encode.c | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/nvim/eval/encode.c b/src/nvim/eval/encode.c index b04e3c04d6..963837fefc 100644 --- a/src/nvim/eval/encode.c +++ b/src/nvim/eval/encode.c @@ -67,10 +67,10 @@ int encode_list_write(void *const data, const char *const buf, const size_t len) line_end = xmemscan(buf, NL, len); if (line_end != buf) { const size_t line_length = (size_t)(line_end - buf); - char *str = (char *)TV_LIST_ITEM_TV(li)->vval.v_string; + char *str = TV_LIST_ITEM_TV(li)->vval.v_string; const size_t li_len = (str == NULL ? 0 : strlen(str)); TV_LIST_ITEM_TV(li)->vval.v_string = xrealloc(str, li_len + line_length + 1); - str = (char *)TV_LIST_ITEM_TV(li)->vval.v_string + li_len; + str = TV_LIST_ITEM_TV(li)->vval.v_string + li_len; memcpy(str, buf, line_length); str[line_length] = 0; memchrsub(str, NUL, NL, line_length); @@ -130,9 +130,10 @@ static int conv_error(const char *const msg, const MPConvStack *const mpstack, case kMPConvDict: { typval_T key_tv = { .v_type = VAR_STRING, - .vval = { .v_string = (v.data.d.hi == NULL - ? v.data.d.dict->dv_hashtab.ht_array - : (v.data.d.hi - 1))->hi_key }, + .vval = { .v_string = + (char *)(v.data.d.hi == + NULL ? v.data.d.dict->dv_hashtab.ht_array : (v.data.d.hi - + 1))->hi_key }, }; char *const key = encode_tv2string(&key_tv, NULL); vim_snprintf((char *)IObuff, IOSIZE, key_msg, key); @@ -263,7 +264,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s || TV_LIST_ITEM_TV(state->li)->vval.v_string != NULL); for (size_t i = state->offset; i < state->li_length && p < buf_end; i++) { assert(TV_LIST_ITEM_TV(state->li)->vval.v_string != NULL); - const char ch = (char)(TV_LIST_ITEM_TV(state->li)->vval.v_string[state->offset++]); + const char ch = TV_LIST_ITEM_TV(state->li)->vval.v_string[state->offset++]; *p++ = (char)(ch == (char)NL ? (char)NUL : ch); } if (p < buf_end) { @@ -869,7 +870,7 @@ char *encode_tv2echo(typval_T *tv, size_t *len) ga_init(&ga, (int)sizeof(char), 80); if (tv->v_type == VAR_STRING || tv->v_type == VAR_FUNC) { if (tv->vval.v_string != NULL) { - ga_concat(&ga, (char *)tv->vval.v_string); + ga_concat(&ga, tv->vval.v_string); } } else { const int eve_ret = encode_vim_to_echo(&ga, tv, N_(":echo argument")); |