0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.1166: code is indented more than necessary

Problem:    Code is indented more than necessary.
Solution:   Use an early return where it makes sense. (Yegappan Lakshmanan,
            closes #11792)
This commit is contained in:
Yegappan Lakshmanan
2023-01-09 19:04:23 +00:00
committed by Bram Moolenaar
parent 765d82a657
commit 1cfb14aa97
22 changed files with 929 additions and 903 deletions

View File

@@ -345,24 +345,25 @@ transstr(char_u *s)
}
else
res = alloc(vim_strsize(s) + 1);
if (res != NULL)
if (res == NULL)
return NULL;
*res = NUL;
p = s;
while (*p != NUL)
{
*res = NUL;
p = s;
while (*p != NUL)
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
{
if (has_mbyte && (l = (*mb_ptr2len)(p)) > 1)
{
c = (*mb_ptr2char)(p);
if (vim_isprintc(c))
STRNCAT(res, p, l); // append printable multi-byte char
else
transchar_hex(res + STRLEN(res), c);
p += l;
}
c = (*mb_ptr2char)(p);
if (vim_isprintc(c))
STRNCAT(res, p, l); // append printable multi-byte char
else
STRCAT(res, transchar_byte(*p++));
transchar_hex(res + STRLEN(res), c);
p += l;
}
else
STRCAT(res, transchar_byte(*p++));
}
return res;
}