diff options
author | ZyX <kp-pav@yandex.ru> | 2017-10-08 21:41:34 +0300 |
---|---|---|
committer | ZyX <kp-pav@yandex.ru> | 2017-10-15 19:13:52 +0300 |
commit | e423cfe1948d75285dad2df151f53400f3b3be4e (patch) | |
tree | 0ed777fa3271b4ce06cfcb0bf94ca6b4ed95178c /src/nvim/edit.c | |
parent | 6f22b5afad23ccc0390a6e2dd61d2e166ac6696a (diff) | |
download | rneovim-e423cfe1948d75285dad2df151f53400f3b3be4e.tar.gz rneovim-e423cfe1948d75285dad2df151f53400f3b3be4e.tar.bz2 rneovim-e423cfe1948d75285dad2df151f53400f3b3be4e.zip |
edit: Lint some functions which are to be copied for symbolic tests
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index ca62679fab..e57598fc91 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -6074,27 +6074,30 @@ void free_last_insert(void) #endif -/* - * Add character "c" to buffer "s". Escape the special meaning of K_SPECIAL - * and CSI. Handle multi-byte characters. - * Returns a pointer to after the added bytes. - */ +/// Add character "c" to buffer "s" +/// +/// Escapes the special meaning of K_SPECIAL and CSI, handles multi-byte +/// characters. +/// +/// @param[in] c Character to add. +/// @param[out] s Buffer to add to. Must have at least MB_MAXBYTES + 1 bytes. +/// +/// @return Pointer to after the added bytes. char_u *add_char2buf(int c, char_u *s) + FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT { char_u temp[MB_MAXBYTES + 1]; - int i; - int len; - - len = (*mb_char2bytes)(c, temp); - for (i = 0; i < len; ++i) { + const int len = utf_char2bytes(c, temp); + for (int i = 0; i < len; ++i) { c = temp[i]; - /* Need to escape K_SPECIAL and CSI like in the typeahead buffer. */ + // Need to escape K_SPECIAL and CSI like in the typeahead buffer. if (c == K_SPECIAL) { *s++ = K_SPECIAL; *s++ = KS_SPECIAL; *s++ = KE_FILLER; - } else + } else { *s++ = c; + } } return s; } |