Simple refatorings that didn't fit the pattern of the last commit

This commit is contained in:
Felipe Oliveira Carvalho 2014-12-13 10:56:17 -03:00
parent 77135447e0
commit 0bc40e660c
6 changed files with 47 additions and 63 deletions

View File

@ -2105,14 +2105,10 @@ void get_winopts(buf_T *buf)
*/
pos_T *buflist_findfpos(buf_T *buf)
{
wininfo_T *wip;
static pos_T no_position = INIT_POS_T(1, 0, 0);
wip = find_wininfo(buf, FALSE);
if (wip != NULL)
return &(wip->wi_fpos);
else
return &no_position;
wininfo_T *wip = find_wininfo(buf, FALSE);
return (wip == NULL) ? &no_position : &(wip->wi_fpos);
}
/*

View File

@ -3329,12 +3329,11 @@ void ex_z(exarg_T *eap)
if (!VIM_ISDIGIT(*x)) {
EMSG(_("E144: non-numeric argument to :z"));
return;
} else {
bigness = atoi((char *)x);
p_window = bigness;
if (*kind == '=')
bigness += 2;
}
bigness = atoi((char *)x);
p_window = bigness;
if (*kind == '=')
bigness += 2;
}
/* the number of '-' and '+' multiplies the distance */

View File

@ -246,28 +246,24 @@ int cause_errthrow(char_u *mesg, int severe, int *ignore)
plist = &(*plist)->next;
elem = xmalloc(sizeof(struct msglist));
{
elem->msg = vim_strsave(mesg);
{
elem->next = NULL;
elem->throw_msg = NULL;
*plist = elem;
if (plist == msg_list || severe) {
char_u *tmsg;
elem->msg = vim_strsave(mesg);
elem->next = NULL;
elem->throw_msg = NULL;
*plist = elem;
if (plist == msg_list || severe) {
char_u *tmsg;
/* Skip the extra "Vim " prefix for message "E458". */
tmsg = elem->msg;
if (STRNCMP(tmsg, "Vim E", 5) == 0
&& VIM_ISDIGIT(tmsg[5])
&& VIM_ISDIGIT(tmsg[6])
&& VIM_ISDIGIT(tmsg[7])
&& tmsg[8] == ':'
&& tmsg[9] == ' ')
(*msg_list)->throw_msg = &tmsg[4];
else
(*msg_list)->throw_msg = tmsg;
}
}
/* Skip the extra "Vim " prefix for message "E458". */
tmsg = elem->msg;
if (STRNCMP(tmsg, "Vim E", 5) == 0
&& VIM_ISDIGIT(tmsg[5])
&& VIM_ISDIGIT(tmsg[6])
&& VIM_ISDIGIT(tmsg[7])
&& tmsg[8] == ':'
&& tmsg[9] == ' ')
(*msg_list)->throw_msg = &tmsg[4];
else
(*msg_list)->throw_msg = tmsg;
}
}
return TRUE;

View File

@ -233,9 +233,7 @@ static int cin_islabel_skip(char_u **s)
*/
int cin_islabel(void)
{ /* XXX */
char_u *s;
s = cin_skipcomment(get_cursor_line_ptr());
char_u *s = cin_skipcomment(get_cursor_line_ptr());
/*
* Exclude "default" from labels, since it should be indented

View File

@ -4283,7 +4283,7 @@ static int comp_char_differs(int off_from, int off_to)
*/
static int char_needs_redraw(int off_from, int off_to, int cols)
{
if (cols > 0
return (cols > 0
&& ((ScreenLines[off_from] != ScreenLines[off_to]
|| ScreenAttrs[off_from] != ScreenAttrs[off_to])
@ -4299,10 +4299,7 @@ static int char_needs_redraw(int off_from, int off_to, int cols)
&& comp_char_differs(off_from, off_to))
|| ((*mb_off2cells)(off_from, off_from + cols) > 1
&& ScreenLines[off_from + 1]
!= ScreenLines[off_to + 1])))
))
return TRUE;
return FALSE;
!= ScreenLines[off_to + 1])))));
}
/*

View File

@ -1513,33 +1513,31 @@ syn_finish_line (
stateitem_T *cur_si;
colnr_T prev_current_col;
if (!current_finished) {
while (!current_finished) {
(void)syn_current_attr(syncing, FALSE, NULL, FALSE);
while (!current_finished) {
(void)syn_current_attr(syncing, FALSE, NULL, FALSE);
/*
* When syncing, and found some item, need to check the item.
*/
if (syncing && current_state.ga_len) {
/*
* When syncing, and found some item, need to check the item.
* Check for match with sync item.
*/
if (syncing && current_state.ga_len) {
/*
* Check for match with sync item.
*/
cur_si = &CUR_STATE(current_state.ga_len - 1);
if (cur_si->si_idx >= 0
&& (SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags
& (HL_SYNC_HERE|HL_SYNC_THERE)))
return TRUE;
cur_si = &CUR_STATE(current_state.ga_len - 1);
if (cur_si->si_idx >= 0
&& (SYN_ITEMS(syn_block)[cur_si->si_idx].sp_flags
& (HL_SYNC_HERE|HL_SYNC_THERE)))
return TRUE;
/* syn_current_attr() will have skipped the check for an item
* that ends here, need to do that now. Be careful not to go
* past the NUL. */
prev_current_col = current_col;
if (syn_getcurline()[current_col] != NUL)
++current_col;
check_state_ends();
current_col = prev_current_col;
}
++current_col;
/* syn_current_attr() will have skipped the check for an item
* that ends here, need to do that now. Be careful not to go
* past the NUL. */
prev_current_col = current_col;
if (syn_getcurline()[current_col] != NUL)
++current_col;
check_state_ends();
current_col = prev_current_col;
}
++current_col;
}
return FALSE;
}