edit: Lint some functions which are to be copied for symbolic tests

This commit is contained in:
ZyX 2017-10-08 21:41:34 +03:00
parent 6f22b5afad
commit e423cfe194

View File

@ -6074,27 +6074,30 @@ void free_last_insert(void)
#endif #endif
/* /// Add character "c" to buffer "s"
* Add character "c" to buffer "s". Escape the special meaning of K_SPECIAL ///
* and CSI. Handle multi-byte characters. /// Escapes the special meaning of K_SPECIAL and CSI, handles multi-byte
* Returns a pointer to after the added bytes. /// 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) char_u *add_char2buf(int c, char_u *s)
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
{ {
char_u temp[MB_MAXBYTES + 1]; char_u temp[MB_MAXBYTES + 1];
int i; const int len = utf_char2bytes(c, temp);
int len; for (int i = 0; i < len; ++i) {
len = (*mb_char2bytes)(c, temp);
for (i = 0; i < len; ++i) {
c = temp[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) { if (c == K_SPECIAL) {
*s++ = K_SPECIAL; *s++ = K_SPECIAL;
*s++ = KS_SPECIAL; *s++ = KS_SPECIAL;
*s++ = KE_FILLER; *s++ = KE_FILLER;
} else } else {
*s++ = c; *s++ = c;
}
} }
return s; return s;
} }