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
36
src/job.c
36
src/job.c
@@ -793,11 +793,11 @@ job_free_job(job_T *job)
|
||||
static void
|
||||
job_free(job_T *job)
|
||||
{
|
||||
if (!in_free_unref_items)
|
||||
{
|
||||
if (in_free_unref_items)
|
||||
return;
|
||||
|
||||
job_free_contents(job);
|
||||
job_free_job(job);
|
||||
}
|
||||
}
|
||||
|
||||
static job_T *jobs_to_free = NULL;
|
||||
@@ -1087,12 +1087,14 @@ set_ref_in_job(int copyID)
|
||||
void
|
||||
job_unref(job_T *job)
|
||||
{
|
||||
if (job != NULL && --job->jv_refcount <= 0)
|
||||
{
|
||||
if (job == NULL || --job->jv_refcount > 0)
|
||||
return;
|
||||
|
||||
// Do not free the job if there is a channel where the close callback
|
||||
// may get the job info.
|
||||
if (!job_channel_still_useful(job))
|
||||
{
|
||||
if (job_channel_still_useful(job))
|
||||
return;
|
||||
|
||||
// Do not free the job when it has not ended yet and there is a
|
||||
// "stoponexit" flag or an exit callback.
|
||||
if (!job_need_end_check(job))
|
||||
@@ -1108,8 +1110,6 @@ job_unref(job_T *job)
|
||||
channel_unref(job->jv_channel);
|
||||
job->jv_channel = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
@@ -1157,8 +1157,9 @@ job_alloc(void)
|
||||
job_T *job;
|
||||
|
||||
job = ALLOC_CLEAR_ONE(job_T);
|
||||
if (job != NULL)
|
||||
{
|
||||
if (job == NULL)
|
||||
return NULL;
|
||||
|
||||
job->jv_refcount = 1;
|
||||
job->jv_stoponexit = vim_strsave((char_u *)"term");
|
||||
|
||||
@@ -1168,7 +1169,6 @@ job_alloc(void)
|
||||
job->jv_next = first_job;
|
||||
}
|
||||
first_job = job;
|
||||
}
|
||||
return job;
|
||||
}
|
||||
|
||||
@@ -1803,13 +1803,13 @@ f_job_getchannel(typval_T *argvars, typval_T *rettv)
|
||||
return;
|
||||
|
||||
job = get_job_arg(&argvars[0]);
|
||||
if (job != NULL)
|
||||
{
|
||||
if (job == NULL)
|
||||
return;
|
||||
|
||||
rettv->v_type = VAR_CHANNEL;
|
||||
rettv->vval.v_channel = job->jv_channel;
|
||||
if (job->jv_channel != NULL)
|
||||
++job->jv_channel->ch_refcount;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1855,13 +1855,13 @@ job_info(job_T *job, dict_T *dict)
|
||||
#endif
|
||||
|
||||
l = list_alloc();
|
||||
if (l != NULL)
|
||||
{
|
||||
if (l == NULL)
|
||||
return;
|
||||
|
||||
dict_add_list(dict, "cmd", l);
|
||||
if (job->jv_argv != NULL)
|
||||
for (i = 0; job->jv_argv[i] != NULL; i++)
|
||||
list_append_string(l, (char_u *)job->jv_argv[i], -1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
42
src/list.c
42
src/list.c
@@ -124,8 +124,9 @@ list_alloc_with_items(int count)
|
||||
|
||||
list_init(l);
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (count <= 0)
|
||||
return l;
|
||||
|
||||
listitem_T *li = (listitem_T *)(l + 1);
|
||||
int i;
|
||||
|
||||
@@ -145,7 +146,6 @@ list_alloc_with_items(int count)
|
||||
li->li_next = li + 1;
|
||||
++li;
|
||||
}
|
||||
}
|
||||
|
||||
return l;
|
||||
}
|
||||
@@ -297,11 +297,11 @@ list_free_items(int copyID)
|
||||
void
|
||||
list_free(list_T *l)
|
||||
{
|
||||
if (!in_free_unref_items)
|
||||
{
|
||||
if (in_free_unref_items)
|
||||
return;
|
||||
|
||||
list_free_contents(l);
|
||||
list_free_list(l);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -540,14 +540,14 @@ list_find_index(list_T *l, long *idx)
|
||||
{
|
||||
listitem_T *li = list_find(l, *idx);
|
||||
|
||||
if (li == NULL)
|
||||
{
|
||||
if (li != NULL)
|
||||
return li;
|
||||
|
||||
if (*idx < 0)
|
||||
{
|
||||
*idx = 0;
|
||||
li = list_find(l, *idx);
|
||||
}
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
@@ -772,8 +772,9 @@ check_range_index_one(list_T *l, long *n1, int can_append, int quiet)
|
||||
long orig_n1 = *n1;
|
||||
listitem_T *li = list_find_index(l, n1);
|
||||
|
||||
if (li == NULL)
|
||||
{
|
||||
if (li != NULL)
|
||||
return li;
|
||||
|
||||
// Vim9: Allow for adding an item at the end.
|
||||
if (can_append && in_vim9script()
|
||||
&& *n1 == l->lv_len && l->lv_lock == 0)
|
||||
@@ -787,7 +788,6 @@ check_range_index_one(list_T *l, long *n1, int can_append, int quiet)
|
||||
semsg(_(e_list_index_out_of_range_nr), orig_n1);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return li;
|
||||
}
|
||||
|
||||
@@ -1286,8 +1286,9 @@ list_copy(list_T *orig, int deep, int top, int copyID)
|
||||
return NULL;
|
||||
|
||||
copy = list_alloc();
|
||||
if (copy != NULL)
|
||||
{
|
||||
if (copy == NULL)
|
||||
return NULL;
|
||||
|
||||
if (orig->lv_type == NULL || top || deep)
|
||||
copy->lv_type = NULL;
|
||||
else
|
||||
@@ -1325,7 +1326,6 @@ list_copy(list_T *orig, int deep, int top, int copyID)
|
||||
list_unref(copy);
|
||||
copy = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
@@ -1491,9 +1491,10 @@ list_join(
|
||||
retval = list_join_inner(gap, l, sep, echo_style, restore_copyID,
|
||||
copyID, &join_ga);
|
||||
|
||||
if (join_ga.ga_data == NULL)
|
||||
return retval;
|
||||
|
||||
// Dispose each item in join_ga.
|
||||
if (join_ga.ga_data != NULL)
|
||||
{
|
||||
p = (join_T *)join_ga.ga_data;
|
||||
for (i = 0; i < join_ga.ga_len; ++i)
|
||||
{
|
||||
@@ -1501,7 +1502,6 @@ list_join(
|
||||
++p;
|
||||
}
|
||||
ga_clear(&join_ga);
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
@@ -2560,8 +2560,9 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap)
|
||||
// message. Avoid a misleading error message for an empty string that
|
||||
// was not passed as argument.
|
||||
expr = &argvars[1];
|
||||
if (expr->v_type != VAR_UNKNOWN)
|
||||
{
|
||||
if (expr->v_type == VAR_UNKNOWN)
|
||||
return;
|
||||
|
||||
typval_T save_val;
|
||||
typval_T save_key;
|
||||
|
||||
@@ -2589,7 +2590,6 @@ filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap)
|
||||
restore_vimvar(VV_VAL, &save_val);
|
||||
|
||||
did_emsg |= save_did_emsg;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
25
src/locale.c
25
src/locale.c
@@ -151,11 +151,13 @@ get_mess_env(void)
|
||||
char_u *p;
|
||||
|
||||
p = mch_getenv((char_u *)"LC_ALL");
|
||||
if (p == NULL || *p == NUL)
|
||||
{
|
||||
if (p != NULL && *p != NUL)
|
||||
return p;
|
||||
|
||||
p = mch_getenv((char_u *)"LC_MESSAGES");
|
||||
if (p == NULL || *p == NUL)
|
||||
{
|
||||
if (p != NULL && *p != NUL)
|
||||
return p;
|
||||
|
||||
p = mch_getenv((char_u *)"LANG");
|
||||
if (p != NULL && VIM_ISDIGIT(*p))
|
||||
p = NULL; // ignore something like "1043"
|
||||
@@ -163,8 +165,6 @@ get_mess_env(void)
|
||||
if (p == NULL || *p == NUL)
|
||||
p = get_locale_val(LC_CTYPE);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
return p;
|
||||
}
|
||||
#endif
|
||||
@@ -504,11 +504,11 @@ find_locales(void)
|
||||
static void
|
||||
init_locales(void)
|
||||
{
|
||||
if (!did_init_locales)
|
||||
{
|
||||
if (did_init_locales)
|
||||
return;
|
||||
|
||||
did_init_locales = TRUE;
|
||||
locales = find_locales();
|
||||
}
|
||||
}
|
||||
|
||||
# if defined(EXITFREE) || defined(PROTO)
|
||||
@@ -516,12 +516,13 @@ init_locales(void)
|
||||
free_locales(void)
|
||||
{
|
||||
int i;
|
||||
if (locales != NULL)
|
||||
{
|
||||
|
||||
if (locales == NULL)
|
||||
return;
|
||||
|
||||
for (i = 0; locales[i] != NULL; i++)
|
||||
vim_free(locales[i]);
|
||||
VIM_CLEAR(locales);
|
||||
}
|
||||
}
|
||||
# endif
|
||||
|
||||
|
13
src/main.c
13
src/main.c
@@ -3099,8 +3099,9 @@ exe_pre_commands(mparm_T *parmp)
|
||||
int i;
|
||||
ESTACK_CHECK_DECLARATION
|
||||
|
||||
if (cnt > 0)
|
||||
{
|
||||
if (cnt <= 0)
|
||||
return;
|
||||
|
||||
curwin->w_cursor.lnum = 0; // just in case..
|
||||
estack_push(ETYPE_ARGS, (char_u *)_("pre-vimrc command line"), 0);
|
||||
ESTACK_CHECK_SETUP
|
||||
@@ -3115,7 +3116,6 @@ exe_pre_commands(mparm_T *parmp)
|
||||
current_sctx.sc_sid = 0;
|
||||
# endif
|
||||
TIME_MSG("--cmd commands");
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -3369,8 +3369,9 @@ process_env(
|
||||
|
||||
ESTACK_CHECK_DECLARATION
|
||||
|
||||
if ((initstr = mch_getenv(env)) != NULL && *initstr != NUL)
|
||||
{
|
||||
if ((initstr = mch_getenv(env)) == NULL || *initstr == NUL)
|
||||
return FAIL;
|
||||
|
||||
if (is_viminit)
|
||||
vimrc_found(NULL, NULL);
|
||||
estack_push(ETYPE_ENV, env, 0);
|
||||
@@ -3389,8 +3390,6 @@ process_env(
|
||||
estack_pop();
|
||||
current_sctx = save_current_sctx;
|
||||
return OK;
|
||||
}
|
||||
return FAIL;
|
||||
}
|
||||
|
||||
#if (defined(UNIX) || defined(VMS)) && !defined(NO_VIM_MAIN)
|
||||
|
17
src/map.c
17
src/map.c
@@ -67,11 +67,11 @@ is_maphash_valid(void)
|
||||
static void
|
||||
validate_maphash(void)
|
||||
{
|
||||
if (!maphash_valid)
|
||||
{
|
||||
if (maphash_valid)
|
||||
return;
|
||||
|
||||
CLEAR_FIELD(maphash);
|
||||
maphash_valid = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -581,8 +581,8 @@ do_map(
|
||||
// needs to be freed later (*keys_buf and *arg_buf).
|
||||
// replace_termcodes() also removes CTRL-Vs and sometimes backslashes.
|
||||
// If something like <C-H> is simplified to 0x08 then mark it as simplified
|
||||
// and also add a n entry with a modifier, which will work when
|
||||
// modifyOtherKeys is working.
|
||||
// and also add an entry with a modifier, which will work when using a key
|
||||
// protocol.
|
||||
if (haskey)
|
||||
{
|
||||
char_u *new_keys;
|
||||
@@ -1843,8 +1843,9 @@ vim_strsave_escape_csi(char_u *p)
|
||||
// illegal utf-8 byte:
|
||||
// 0xc0 -> 0xc3 0x80 -> 0xc3 K_SPECIAL KS_SPECIAL KE_FILLER
|
||||
res = alloc(STRLEN(p) * 4 + 1);
|
||||
if (res != NULL)
|
||||
{
|
||||
if (res == NULL)
|
||||
return NULL;
|
||||
|
||||
d = res;
|
||||
for (s = p; *s != NUL; )
|
||||
{
|
||||
@@ -1868,7 +1869,7 @@ vim_strsave_escape_csi(char_u *p)
|
||||
}
|
||||
}
|
||||
*d = NUL;
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@@ -485,8 +485,9 @@ fname2fnum(xfmark_T *fm)
|
||||
{
|
||||
char_u *p;
|
||||
|
||||
if (fm->fname != NULL)
|
||||
{
|
||||
if (fm->fname == NULL)
|
||||
return;
|
||||
|
||||
/*
|
||||
* First expand "~/" in the file name to the home directory.
|
||||
* Don't expand the whole name, it may contain other '~' chars.
|
||||
@@ -512,7 +513,6 @@ fname2fnum(xfmark_T *fm)
|
||||
|
||||
// buflist_new() will call fmarks_check_names()
|
||||
(void)buflist_new(NameBuff, p, (linenr_T)1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
12
src/match.c
12
src/match.c
@@ -978,15 +978,15 @@ matchadd_dict_arg(typval_T *tv, char_u **conceal_char, win_T **win)
|
||||
if (dict_has_key(tv->vval.v_dict, "conceal"))
|
||||
*conceal_char = dict_get_string(tv->vval.v_dict, "conceal", FALSE);
|
||||
|
||||
if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) != NULL)
|
||||
{
|
||||
if ((di = dict_find(tv->vval.v_dict, (char_u *)"window", -1)) == NULL)
|
||||
return OK;
|
||||
|
||||
*win = find_win_by_nr_or_id(&di->di_tv);
|
||||
if (*win == NULL)
|
||||
{
|
||||
emsg(_(e_invalid_window_number));
|
||||
return FAIL;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
}
|
||||
@@ -1330,8 +1330,9 @@ f_matchaddpos(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
|
||||
void
|
||||
f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) == OK)
|
||||
{
|
||||
if (rettv_list_alloc(rettv) != OK)
|
||||
return;
|
||||
|
||||
# ifdef FEAT_SEARCH_EXTRA
|
||||
int id;
|
||||
matchitem_T *m;
|
||||
@@ -1355,7 +1356,6 @@ f_matcharg(typval_T *argvars UNUSED, typval_T *rettv)
|
||||
}
|
||||
}
|
||||
# endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
18
src/mbyte.c
18
src/mbyte.c
@@ -809,8 +809,9 @@ bomb_size(void)
|
||||
void
|
||||
remove_bom(char_u *s)
|
||||
{
|
||||
if (enc_utf8)
|
||||
{
|
||||
if (!enc_utf8)
|
||||
return;
|
||||
|
||||
char_u *p = s;
|
||||
|
||||
while ((p = vim_strbyte(p, 0xef)) != NULL)
|
||||
@@ -820,7 +821,6 @@ remove_bom(char_u *s)
|
||||
else
|
||||
++p;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -4590,8 +4590,9 @@ enc_canonize(char_u *enc)
|
||||
|
||||
// copy "enc" to allocated memory, with room for two '-'
|
||||
r = alloc(STRLEN(enc) + 3);
|
||||
if (r != NULL)
|
||||
{
|
||||
if (r == NULL)
|
||||
return NULL;
|
||||
|
||||
// Make it all lower case and replace '_' with '-'.
|
||||
p = r;
|
||||
for (s = enc; *s != NUL; ++s)
|
||||
@@ -4640,7 +4641,6 @@ enc_canonize(char_u *enc)
|
||||
vim_free(r);
|
||||
r = vim_strsave((char_u *)enc_canon_table[i].name);
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
@@ -5269,8 +5269,9 @@ convert_input_safe(
|
||||
|
||||
d = string_convert_ext(&input_conv, ptr, &dlen,
|
||||
restp == NULL ? NULL : &unconvertlen);
|
||||
if (d != NULL)
|
||||
{
|
||||
if (d == NULL)
|
||||
return dlen;
|
||||
|
||||
if (dlen <= maxlen)
|
||||
{
|
||||
if (unconvertlen > 0)
|
||||
@@ -5288,7 +5289,6 @@ convert_input_safe(
|
||||
// have done something wrong!)
|
||||
dlen = len;
|
||||
vim_free(d);
|
||||
}
|
||||
return dlen;
|
||||
}
|
||||
|
||||
|
@@ -879,8 +879,9 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count)
|
||||
{
|
||||
bhdr_T *hp;
|
||||
|
||||
if ((hp = ALLOC_ONE(bhdr_T)) != NULL)
|
||||
{
|
||||
if ((hp = ALLOC_ONE(bhdr_T)) == NULL)
|
||||
return NULL;
|
||||
|
||||
if ((hp->bh_data = alloc((size_t)mfp->mf_page_size * page_count))
|
||||
== NULL)
|
||||
{
|
||||
@@ -888,7 +889,6 @@ mf_alloc_bhdr(memfile_T *mfp, int page_count)
|
||||
return NULL;
|
||||
}
|
||||
hp->bh_page_count = page_count;
|
||||
}
|
||||
return hp;
|
||||
}
|
||||
|
||||
@@ -1209,12 +1209,12 @@ mf_set_ffname(memfile_T *mfp)
|
||||
void
|
||||
mf_fullname(memfile_T *mfp)
|
||||
{
|
||||
if (mfp != NULL && mfp->mf_fname != NULL && mfp->mf_ffname != NULL)
|
||||
{
|
||||
if (mfp == NULL || mfp->mf_fname == NULL || mfp->mf_ffname == NULL)
|
||||
return;
|
||||
|
||||
vim_free(mfp->mf_fname);
|
||||
mfp->mf_fname = mfp->mf_ffname;
|
||||
mfp->mf_ffname = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -422,8 +422,9 @@ error:
|
||||
static void
|
||||
ml_set_mfp_crypt(buf_T *buf)
|
||||
{
|
||||
if (*buf->b_p_key != NUL)
|
||||
{
|
||||
if (*buf->b_p_key == NUL)
|
||||
return;
|
||||
|
||||
int method_nr = crypt_get_method_nr(buf);
|
||||
|
||||
if (method_nr > CRYPT_M_ZIP && method_nr < CRYPT_M_SOD)
|
||||
@@ -435,8 +436,7 @@ ml_set_mfp_crypt(buf_T *buf)
|
||||
else if (method_nr == CRYPT_M_SOD)
|
||||
crypt_sodium_randombytes_buf(buf->b_ml.ml_mfp->mf_seed,
|
||||
MF_SEED_LEN);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2090,8 +2090,9 @@ make_percent_swname(char_u *dir, char_u *name)
|
||||
char_u *d = NULL, *s, *f;
|
||||
|
||||
f = fix_fname(name != NULL ? name : (char_u *)"");
|
||||
if (f != NULL)
|
||||
{
|
||||
if (f == NULL)
|
||||
return NULL;
|
||||
|
||||
s = alloc(STRLEN(f) + 1);
|
||||
if (s != NULL)
|
||||
{
|
||||
@@ -2105,7 +2106,6 @@ make_percent_swname(char_u *dir, char_u *name)
|
||||
vim_free(s);
|
||||
}
|
||||
vim_free(f);
|
||||
}
|
||||
return d;
|
||||
}
|
||||
#endif
|
||||
@@ -5473,8 +5473,9 @@ ml_decrypt_data(
|
||||
int text_len;
|
||||
cryptstate_T *state;
|
||||
|
||||
if (dp->db_id == DATA_ID)
|
||||
{
|
||||
if (dp->db_id != DATA_ID)
|
||||
return;
|
||||
|
||||
head_end = (char_u *)(&dp->db_index[dp->db_line_count]);
|
||||
text_start = (char_u *)dp + dp->db_txt_start;
|
||||
text_len = dp->db_txt_end - dp->db_txt_start;
|
||||
@@ -5484,13 +5485,12 @@ ml_decrypt_data(
|
||||
return; // data was messed up
|
||||
|
||||
state = ml_crypt_prepare(mfp, offset, TRUE);
|
||||
if (state != NULL)
|
||||
{
|
||||
if (state == NULL)
|
||||
return;
|
||||
|
||||
// Decrypt the text in place.
|
||||
crypt_decode_inplace(state, text_start, text_len, FALSE);
|
||||
crypt_free_state(state);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
24
src/menu.c
24
src/menu.c
@@ -1763,12 +1763,12 @@ popup_mode_name(char_u *name, int idx)
|
||||
int i;
|
||||
|
||||
p = vim_strnsave(name, len + mode_chars_len);
|
||||
if (p != NULL)
|
||||
{
|
||||
if (p == NULL)
|
||||
return NULL;
|
||||
|
||||
mch_memmove(p + 5 + mode_chars_len, p + 5, (size_t)(len - 4));
|
||||
for (i = 0; i < mode_chars_len; ++i)
|
||||
p[5 + i] = menu_mode_chars[idx][i];
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
@@ -2008,8 +2008,9 @@ show_popupmenu(void)
|
||||
break;
|
||||
|
||||
// Only show a popup when it is defined and has entries
|
||||
if (menu != NULL && menu->children != NULL)
|
||||
{
|
||||
if (menu == NULL || menu->children == NULL)
|
||||
return;
|
||||
|
||||
# if defined(FEAT_GUI)
|
||||
if (gui.in_use)
|
||||
{
|
||||
@@ -2025,7 +2026,6 @@ show_popupmenu(void)
|
||||
# if defined(FEAT_TERM_POPUP_MENU)
|
||||
pum_show_popupmenu(menu);
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2255,8 +2255,9 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
|
||||
vimmenu_T menuarg;
|
||||
|
||||
tbuf = alloc(5 + (unsigned int)STRLEN(tearpath));
|
||||
if (tbuf != NULL)
|
||||
{
|
||||
if (tbuf == NULL)
|
||||
return;
|
||||
|
||||
tbuf[0] = K_SPECIAL;
|
||||
tbuf[1] = K_SECOND(K_TEAROFF);
|
||||
tbuf[2] = K_THIRD(K_TEAROFF);
|
||||
@@ -2287,7 +2288,6 @@ gui_add_tearoff(char_u *tearpath, int *pri_tab, int pri_idx)
|
||||
|
||||
pri_tab[pri_idx + 1] = t;
|
||||
vim_free(tbuf);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -2789,8 +2789,9 @@ menutrans_lookup(char_u *name, int len)
|
||||
name[len] = NUL;
|
||||
dname = menu_text(name, NULL, NULL);
|
||||
name[len] = i;
|
||||
if (dname != NULL)
|
||||
{
|
||||
if (dname == NULL)
|
||||
return NULL;
|
||||
|
||||
for (i = 0; i < menutrans_ga.ga_len; ++i)
|
||||
if (STRICMP(dname, tp[i].from_noamp) == 0)
|
||||
{
|
||||
@@ -2798,7 +2799,6 @@ menutrans_lookup(char_u *name, int len)
|
||||
return tp[i].to;
|
||||
}
|
||||
vim_free(dname);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -834,8 +828,9 @@ semsg(const char *s, ...)
|
||||
void
|
||||
iemsg(char *s)
|
||||
{
|
||||
if (!emsg_not_now())
|
||||
{
|
||||
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);
|
||||
@@ -843,7 +838,6 @@ iemsg(char *s)
|
||||
out_flush();
|
||||
abort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef PROTO // manual proto with __attribute__
|
||||
@@ -856,8 +850,9 @@ iemsg(char *s)
|
||||
void
|
||||
siemsg(const char *s, ...)
|
||||
{
|
||||
if (!emsg_not_now())
|
||||
{
|
||||
if (emsg_not_now())
|
||||
return;
|
||||
|
||||
if (IObuff == NULL)
|
||||
{
|
||||
// Very early in initialisation and already something wrong, just
|
||||
@@ -878,7 +873,6 @@ siemsg(const char *s, ...)
|
||||
out_flush();
|
||||
abort();
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1006,8 +1000,9 @@ 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
|
||||
@@ -1027,7 +1022,6 @@ add_msg_hist(
|
||||
if (first_msg_hist == NULL)
|
||||
first_msg_hist = last_msg_hist;
|
||||
++msg_hist_len;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -1119,8 +1119,9 @@ vim_beep(unsigned val)
|
||||
called_vim_beep = TRUE;
|
||||
#endif
|
||||
|
||||
if (emsg_silent == 0 && !in_assert_fails)
|
||||
{
|
||||
if (emsg_silent != 0 || in_assert_fails)
|
||||
return;
|
||||
|
||||
if (!((bo_flags & val) || (bo_flags & BO_ALL)))
|
||||
{
|
||||
#ifdef ELAPSED_FUNC
|
||||
@@ -1172,7 +1173,6 @@ vim_beep(unsigned val)
|
||||
msg_source(HL_ATTR(HLF_W));
|
||||
msg_attr(_("Beep!"), HL_ATTR(HLF_W));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
18
src/misc2.c
18
src/misc2.c
@@ -1130,8 +1130,9 @@ simplify_key(int key, int *modifiers)
|
||||
int key0;
|
||||
int key1;
|
||||
|
||||
if (*modifiers & (MOD_MASK_SHIFT | MOD_MASK_CTRL | MOD_MASK_ALT))
|
||||
{
|
||||
if (!(*modifiers & (MOD_MASK_SHIFT | MOD_MASK_CTRL | MOD_MASK_ALT)))
|
||||
return key;
|
||||
|
||||
// TAB is a special case
|
||||
if (key == TAB && (*modifiers & MOD_MASK_SHIFT))
|
||||
{
|
||||
@@ -1141,6 +1142,7 @@ simplify_key(int key, int *modifiers)
|
||||
key0 = KEY2TERMCAP0(key);
|
||||
key1 = KEY2TERMCAP1(key);
|
||||
for (i = 0; modifier_keys_table[i] != NUL; i += MOD_KEYS_ENTRY_SIZE)
|
||||
{
|
||||
if (key0 == modifier_keys_table[i + 3]
|
||||
&& key1 == modifier_keys_table[i + 4]
|
||||
&& (*modifiers & modifier_keys_table[i]))
|
||||
@@ -1537,8 +1539,9 @@ find_special_key(
|
||||
int
|
||||
may_adjust_key_for_ctrl(int modifiers, int key)
|
||||
{
|
||||
if (modifiers & MOD_MASK_CTRL)
|
||||
{
|
||||
if (!(modifiers & MOD_MASK_CTRL))
|
||||
return key;
|
||||
|
||||
if (ASCII_ISALPHA(key))
|
||||
{
|
||||
#ifdef FEAT_TERMINAL
|
||||
@@ -1552,7 +1555,6 @@ may_adjust_key_for_ctrl(int modifiers, int key)
|
||||
return '^';
|
||||
if (key == '-')
|
||||
return '_';
|
||||
}
|
||||
return key;
|
||||
}
|
||||
|
||||
@@ -2820,8 +2822,9 @@ read_string(FILE *fd, int cnt)
|
||||
|
||||
// allocate memory
|
||||
str = alloc(cnt + 1);
|
||||
if (str != NULL)
|
||||
{
|
||||
if (str == NULL)
|
||||
return NULL;
|
||||
|
||||
// Read the string. Quit when running into the EOF.
|
||||
for (i = 0; i < cnt; ++i)
|
||||
{
|
||||
@@ -2834,7 +2837,6 @@ read_string(FILE *fd, int cnt)
|
||||
str[i] = c;
|
||||
}
|
||||
str[i] = NUL;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
|
33
src/move.c
33
src/move.c
@@ -244,15 +244,15 @@ skipcol_from_plines(win_T *wp, int plines_off)
|
||||
static void
|
||||
reset_skipcol(void)
|
||||
{
|
||||
if (curwin->w_skipcol != 0)
|
||||
{
|
||||
if (curwin->w_skipcol == 0)
|
||||
return;
|
||||
|
||||
curwin->w_skipcol = 0;
|
||||
|
||||
// Should use the least expensive way that displays all that changed.
|
||||
// UPD_NOT_VALID is too expensive, UPD_REDRAW_TOP does not redraw
|
||||
// enough when the top line gets another screen line.
|
||||
redraw_later(UPD_SOME_VALID);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -980,8 +980,10 @@ validate_virtcol(void)
|
||||
validate_virtcol_win(win_T *wp)
|
||||
{
|
||||
check_cursor_moved(wp);
|
||||
if (!(wp->w_valid & VALID_VIRTCOL))
|
||||
{
|
||||
|
||||
if (wp->w_valid & VALID_VIRTCOL)
|
||||
return;
|
||||
|
||||
#ifdef FEAT_PROP_POPUP
|
||||
wp->w_virtcol_first_char = 0;
|
||||
#endif
|
||||
@@ -990,7 +992,6 @@ validate_virtcol_win(win_T *wp)
|
||||
redraw_for_cursorcolumn(wp);
|
||||
#endif
|
||||
wp->w_valid |= VALID_VIRTCOL;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1000,8 +1001,10 @@ validate_virtcol_win(win_T *wp)
|
||||
validate_cheight(void)
|
||||
{
|
||||
check_cursor_moved(curwin);
|
||||
if (!(curwin->w_valid & VALID_CHEIGHT))
|
||||
{
|
||||
|
||||
if (curwin->w_valid & VALID_CHEIGHT)
|
||||
return;
|
||||
|
||||
#ifdef FEAT_DIFF
|
||||
if (curwin->w_cursor.lnum == curwin->w_topline)
|
||||
curwin->w_cline_height = plines_nofill(curwin->w_cursor.lnum)
|
||||
@@ -1013,7 +1016,6 @@ validate_cheight(void)
|
||||
curwin->w_cline_folded = hasFolding(curwin->w_cursor.lnum, NULL, NULL);
|
||||
#endif
|
||||
curwin->w_valid |= VALID_CHEIGHT;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1027,8 +1029,10 @@ validate_cursor_col(void)
|
||||
int width;
|
||||
|
||||
validate_virtcol();
|
||||
if (!(curwin->w_valid & VALID_WCOL))
|
||||
{
|
||||
|
||||
if (curwin->w_valid & VALID_WCOL)
|
||||
return;
|
||||
|
||||
col = curwin->w_virtcol;
|
||||
off = curwin_col_off();
|
||||
col += off;
|
||||
@@ -1050,7 +1054,6 @@ validate_cursor_col(void)
|
||||
#ifdef FEAT_PROP_POPUP
|
||||
curwin->w_flags &= ~WFLAG_WCOL_OFF_ADDED;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1999,8 +2002,9 @@ check_topfill(
|
||||
{
|
||||
int n;
|
||||
|
||||
if (wp->w_topfill > 0)
|
||||
{
|
||||
if (wp->w_topfill <= 0)
|
||||
return;
|
||||
|
||||
n = plines_win_nofill(wp, wp->w_topline, TRUE);
|
||||
if (wp->w_topfill + n > wp->w_height)
|
||||
{
|
||||
@@ -2016,7 +2020,6 @@ check_topfill(
|
||||
wp->w_topfill = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -695,6 +695,8 @@ static char *(features[]) =
|
||||
|
||||
static int included_patches[] =
|
||||
{ /* Add new patch number below this line */
|
||||
/**/
|
||||
1196,
|
||||
/**/
|
||||
1195,
|
||||
/**/
|
||||
|
Reference in New Issue
Block a user