forked from aniani/vim
patch 9.0.1196: 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 #11813)
This commit is contained in:
committed by
Bram Moolenaar
parent
378e6c03f9
commit
e857598896
140
src/message.c
140
src/message.c
@@ -375,15 +375,13 @@ smsg(const char *s, ...)
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return msg((char *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg((char *)IObuff);
|
||||
}
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg((char *)IObuff);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -395,15 +393,13 @@ smsg_attr(int attr, const char *s, ...)
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return msg_attr((char *)s, attr);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr((char *)IObuff, attr);
|
||||
}
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr((char *)IObuff, attr);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -415,15 +411,13 @@ smsg_attr_keep(int attr, const char *s, ...)
|
||||
// give the raw message so the user at least gets a hint.
|
||||
return msg_attr_keep((char *)s, attr, TRUE);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr_keep((char *)IObuff, attr, TRUE);
|
||||
}
|
||||
va_list arglist;
|
||||
|
||||
va_start(arglist, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, arglist);
|
||||
va_end(arglist);
|
||||
return msg_attr_keep((char *)IObuff, attr, TRUE);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -834,16 +828,16 @@ semsg(const char *s, ...)
|
||||
void
|
||||
iemsg(char *s)
|
||||
{
|
||||
if (!emsg_not_now())
|
||||
{
|
||||
emsg_core((char_u *)s);
|
||||
if (emsg_not_now())
|
||||
return;
|
||||
|
||||
emsg_core((char_u *)s);
|
||||
#if defined(ABORT_ON_INTERNAL_ERROR) && defined(FEAT_EVAL)
|
||||
set_vim_var_string(VV_ERRMSG, (char_u *)s, -1);
|
||||
msg_putchar('\n'); // avoid overwriting the error message
|
||||
out_flush();
|
||||
abort();
|
||||
set_vim_var_string(VV_ERRMSG, (char_u *)s, -1);
|
||||
msg_putchar('\n'); // avoid overwriting the error message
|
||||
out_flush();
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PROTO // manual proto with __attribute__
|
||||
@@ -856,29 +850,29 @@ iemsg(char *s)
|
||||
void
|
||||
siemsg(const char *s, ...)
|
||||
{
|
||||
if (!emsg_not_now())
|
||||
{
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
emsg_core((char_u *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
if (emsg_not_now())
|
||||
return;
|
||||
|
||||
va_start(ap, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, ap);
|
||||
va_end(ap);
|
||||
emsg_core(IObuff);
|
||||
}
|
||||
# ifdef ABORT_ON_INTERNAL_ERROR
|
||||
msg_putchar('\n'); // avoid overwriting the error message
|
||||
out_flush();
|
||||
abort();
|
||||
# endif
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
// give the raw message so the user at least gets a hint.
|
||||
emsg_core((char_u *)s);
|
||||
}
|
||||
else
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap, s);
|
||||
vim_vsnprintf((char *)IObuff, IOSIZE, s, ap);
|
||||
va_end(ap);
|
||||
emsg_core(IObuff);
|
||||
}
|
||||
# ifdef ABORT_ON_INTERNAL_ERROR
|
||||
msg_putchar('\n'); // avoid overwriting the error message
|
||||
out_flush();
|
||||
abort();
|
||||
# endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1006,28 +1000,28 @@ add_msg_hist(
|
||||
|
||||
// allocate an entry and add the message at the end of the history
|
||||
p = ALLOC_ONE(struct msg_hist);
|
||||
if (p != NULL)
|
||||
if (p == NULL)
|
||||
return;
|
||||
|
||||
if (len < 0)
|
||||
len = (int)STRLEN(s);
|
||||
// remove leading and trailing newlines
|
||||
while (len > 0 && *s == '\n')
|
||||
{
|
||||
if (len < 0)
|
||||
len = (int)STRLEN(s);
|
||||
// remove leading and trailing newlines
|
||||
while (len > 0 && *s == '\n')
|
||||
{
|
||||
++s;
|
||||
--len;
|
||||
}
|
||||
while (len > 0 && s[len - 1] == '\n')
|
||||
--len;
|
||||
p->msg = vim_strnsave(s, len);
|
||||
p->next = NULL;
|
||||
p->attr = attr;
|
||||
if (last_msg_hist != NULL)
|
||||
last_msg_hist->next = p;
|
||||
last_msg_hist = p;
|
||||
if (first_msg_hist == NULL)
|
||||
first_msg_hist = last_msg_hist;
|
||||
++msg_hist_len;
|
||||
++s;
|
||||
--len;
|
||||
}
|
||||
while (len > 0 && s[len - 1] == '\n')
|
||||
--len;
|
||||
p->msg = vim_strnsave(s, len);
|
||||
p->next = NULL;
|
||||
p->attr = attr;
|
||||
if (last_msg_hist != NULL)
|
||||
last_msg_hist->next = p;
|
||||
last_msg_hist = p;
|
||||
if (first_msg_hist == NULL)
|
||||
first_msg_hist = last_msg_hist;
|
||||
++msg_hist_len;
|
||||
}
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user