0
0
mirror of https://github.com/vim/vim.git synced 2025-09-25 03:54:15 -04:00

patch 9.0.1246: 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 #11887)
This commit is contained in:
Yegappan Lakshmanan
2023-01-26 12:00:00 +00:00
committed by Bram Moolenaar
parent 032713f829
commit 142ed77898
13 changed files with 510 additions and 515 deletions

View File

@@ -83,20 +83,20 @@ ui_inchar_undo(char_u *s, int len)
if (ta_str != NULL)
newlen += ta_len - ta_off;
new = alloc(newlen);
if (new != NULL)
if (new == NULL)
return;
if (ta_str != NULL)
{
if (ta_str != NULL)
{
mch_memmove(new, ta_str + ta_off, (size_t)(ta_len - ta_off));
mch_memmove(new + ta_len - ta_off, s, (size_t)len);
vim_free(ta_str);
}
else
mch_memmove(new, s, (size_t)len);
ta_str = new;
ta_len = newlen;
ta_off = 0;
mch_memmove(new, ta_str + ta_off, (size_t)(ta_len - ta_off));
mch_memmove(new + ta_len - ta_off, s, (size_t)len);
vim_free(ta_str);
}
else
mch_memmove(new, s, (size_t)len);
ta_str = new;
ta_len = newlen;
ta_off = 0;
}
#endif
@@ -815,25 +815,25 @@ set_input_buf(char_u *p, int overwrite)
{
garray_T *gap = (garray_T *)p;
if (gap != NULL)
if (gap == NULL)
return;
if (gap->ga_data != NULL)
{
if (gap->ga_data != NULL)
if (overwrite || inbufcount + gap->ga_len >= INBUFLEN)
{
if (overwrite || inbufcount + gap->ga_len >= INBUFLEN)
{
mch_memmove(inbuf, gap->ga_data, gap->ga_len);
inbufcount = gap->ga_len;
}
else
{
mch_memmove(inbuf + gap->ga_len, inbuf, inbufcount);
mch_memmove(inbuf, gap->ga_data, gap->ga_len);
inbufcount += gap->ga_len;
}
vim_free(gap->ga_data);
mch_memmove(inbuf, gap->ga_data, gap->ga_len);
inbufcount = gap->ga_len;
}
vim_free(gap);
else
{
mch_memmove(inbuf + gap->ga_len, inbuf, inbufcount);
mch_memmove(inbuf, gap->ga_data, gap->ga_len);
inbufcount += gap->ga_len;
}
vim_free(gap->ga_data);
}
vim_free(gap);
}
/*