mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
Remove OOM error handling code after calls to transstr()
transstr() doesn't return NULL anymore.
This commit is contained in:

committed by
Thiago de Arruda

parent
b8bda77e39
commit
b4545740fd
@@ -330,7 +330,7 @@ void trans_characters(char_u *buf, int bufsize)
|
||||
///
|
||||
/// @param s
|
||||
///
|
||||
/// @return translated string or NULL if out of memory.
|
||||
/// @return translated string
|
||||
char_u *transstr(char_u *s)
|
||||
{
|
||||
char_u *res;
|
||||
@@ -371,26 +371,25 @@ char_u *transstr(char_u *s)
|
||||
res = alloc((unsigned)(vim_strsize(s) + 1));
|
||||
}
|
||||
|
||||
if (res != NULL) {
|
||||
*res = NUL;
|
||||
p = s;
|
||||
*res = NUL;
|
||||
p = s;
|
||||
|
||||
while (*p != NUL) {
|
||||
if (has_mbyte && ((l = (*mb_ptr2len)(p)) > 1)) {
|
||||
c = (*mb_ptr2char)(p);
|
||||
while (*p != NUL) {
|
||||
if (has_mbyte && ((l = (*mb_ptr2len)(p)) > 1)) {
|
||||
c = (*mb_ptr2char)(p);
|
||||
|
||||
if (vim_isprintc(c)) {
|
||||
// append printable multi-byte char
|
||||
STRNCAT(res, p, l);
|
||||
} else {
|
||||
transchar_hex(res + STRLEN(res), c);
|
||||
}
|
||||
p += l;
|
||||
if (vim_isprintc(c)) {
|
||||
// append printable multi-byte char
|
||||
STRNCAT(res, p, l);
|
||||
} else {
|
||||
STRCAT(res, transchar_byte(*p++));
|
||||
transchar_hex(res + STRLEN(res), c);
|
||||
}
|
||||
p += l;
|
||||
} else {
|
||||
STRCAT(res, transchar_byte(*p++));
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user