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) pos_T *buflist_findfpos(buf_T *buf)
{ {
wininfo_T *wip;
static pos_T no_position = INIT_POS_T(1, 0, 0); static pos_T no_position = INIT_POS_T(1, 0, 0);
wip = find_wininfo(buf, FALSE); wininfo_T *wip = find_wininfo(buf, FALSE);
if (wip != NULL) return (wip == NULL) ? &no_position : &(wip->wi_fpos);
return &(wip->wi_fpos);
else
return &no_position;
} }
/* /*

View File

@ -3329,12 +3329,11 @@ void ex_z(exarg_T *eap)
if (!VIM_ISDIGIT(*x)) { if (!VIM_ISDIGIT(*x)) {
EMSG(_("E144: non-numeric argument to :z")); EMSG(_("E144: non-numeric argument to :z"));
return; 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 */ /* 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; plist = &(*plist)->next;
elem = xmalloc(sizeof(struct msglist)); elem = xmalloc(sizeof(struct msglist));
{ elem->msg = vim_strsave(mesg);
elem->msg = vim_strsave(mesg); elem->next = NULL;
{ elem->throw_msg = NULL;
elem->next = NULL; *plist = elem;
elem->throw_msg = NULL; if (plist == msg_list || severe) {
*plist = elem; char_u *tmsg;
if (plist == msg_list || severe) {
char_u *tmsg;
/* Skip the extra "Vim " prefix for message "E458". */ /* Skip the extra "Vim " prefix for message "E458". */
tmsg = elem->msg; tmsg = elem->msg;
if (STRNCMP(tmsg, "Vim E", 5) == 0 if (STRNCMP(tmsg, "Vim E", 5) == 0
&& VIM_ISDIGIT(tmsg[5]) && VIM_ISDIGIT(tmsg[5])
&& VIM_ISDIGIT(tmsg[6]) && VIM_ISDIGIT(tmsg[6])
&& VIM_ISDIGIT(tmsg[7]) && VIM_ISDIGIT(tmsg[7])
&& tmsg[8] == ':' && tmsg[8] == ':'
&& tmsg[9] == ' ') && tmsg[9] == ' ')
(*msg_list)->throw_msg = &tmsg[4]; (*msg_list)->throw_msg = &tmsg[4];
else else
(*msg_list)->throw_msg = tmsg; (*msg_list)->throw_msg = tmsg;
}
}
} }
} }
return TRUE; return TRUE;

View File

@ -233,9 +233,7 @@ static int cin_islabel_skip(char_u **s)
*/ */
int cin_islabel(void) int cin_islabel(void)
{ /* XXX */ { /* XXX */
char_u *s; char_u *s = cin_skipcomment(get_cursor_line_ptr());
s = cin_skipcomment(get_cursor_line_ptr());
/* /*
* Exclude "default" from labels, since it should be indented * 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) 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] && ((ScreenLines[off_from] != ScreenLines[off_to]
|| ScreenAttrs[off_from] != ScreenAttrs[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)) && comp_char_differs(off_from, off_to))
|| ((*mb_off2cells)(off_from, off_from + cols) > 1 || ((*mb_off2cells)(off_from, off_from + cols) > 1
&& ScreenLines[off_from + 1] && ScreenLines[off_from + 1]
!= ScreenLines[off_to + 1]))) != ScreenLines[off_to + 1])))));
))
return TRUE;
return FALSE;
} }
/* /*

View File

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