0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

patch 9.0.1245: 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 #11879)
This commit is contained in:
Yegappan Lakshmanan
2023-01-25 21:05:38 +00:00
committed by Bram Moolenaar
parent 0f843ef091
commit 032713f829
9 changed files with 965 additions and 959 deletions

View File

@@ -3263,8 +3263,9 @@ static garray_T tag_fnames = GA_EMPTY;
static void
found_tagfile_cb(char_u *fname, void *cookie UNUSED)
{
if (ga_grow(&tag_fnames, 1) == OK)
{
if (ga_grow(&tag_fnames, 1) == FAIL)
return;
char_u *tag_fname = vim_strsave(fname);
#ifdef BACKSLASH_IN_FILENAME
@@ -3273,7 +3274,6 @@ found_tagfile_cb(char_u *fname, void *cookie UNUSED)
simplify_filename(tag_fname);
((char_u **)(tag_fnames.ga_data))[tag_fnames.ga_len++] = tag_fname;
}
}
#if defined(EXITFREE) || defined(PROTO)
void
@@ -3587,8 +3587,9 @@ parse_match(
tagp->tagline = 0;
tagp->command_end = NULL;
if (retval == OK)
{
if (retval != OK)
return retval;
// Try to find a kind field: "kind:<kind>" or just "<kind>"
p = tagp->command;
if (find_extra(&p) == OK)
@@ -3635,7 +3636,6 @@ parse_match(
;
tagp->user_data_end = p;
}
}
return retval;
}
@@ -4372,8 +4372,9 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
ret = find_tags(pat, &num_matches, &matches,
TAG_REGEXP | TAG_NOIC, (int)MAXCOL, buf_fname);
if (ret == OK && num_matches > 0)
{
if (ret != OK || num_matches <= 0)
return ret;
for (i = 0; i < num_matches; ++i)
{
if (parse_match(matches[i], &tp) == FAIL)
@@ -4459,7 +4460,6 @@ get_tags(list_T *list, char_u *pat, char_u *buf_fname)
vim_free(matches[i]);
}
vim_free(matches);
}
return ret;
}

View File

@@ -1644,8 +1644,9 @@ set_color_count(int nr)
static void
may_adjust_color_count(int val)
{
if (val != t_colors)
{
if (val == t_colors)
return;
// Nr of colors changed, initialize highlighting and redraw everything.
// This causes a redraw, which usually clears the message. Try keeping
// the message if it might work.
@@ -1662,7 +1663,6 @@ may_adjust_color_count(int val)
redraw_asap(UPD_CLEAR);
#endif
}
}
#ifdef HAVE_TGETENT
static char *(key_names[]) =
@@ -2419,14 +2419,15 @@ getlinecol(
{
char_u tbuf[TBUFSZ];
if (T_NAME != NULL && *T_NAME != NUL && invoke_tgetent(tbuf, T_NAME) == NULL)
{
if (T_NAME == NULL || *T_NAME == NUL
|| invoke_tgetent(tbuf, T_NAME) != NULL)
return;
if (*cp == 0)
*cp = tgetnum("co");
if (*rp == 0)
*rp = tgetnum("li");
}
}
#endif // defined(HAVE_TGETENT) && defined(UNIX)
/*
@@ -2569,15 +2570,15 @@ term_is_8bit(char_u *name)
static int
term_7to8bit(char_u *p)
{
if (*p == ESC)
{
if (*p != ESC)
return 0;
if (p[1] == '[')
return CSI;
if (p[1] == ']')
else if (p[1] == ']')
return OSC;
if (p[1] == 'O')
else if (p[1] == 'O')
return 0x8f;
}
return 0;
}
@@ -2712,8 +2713,9 @@ out_flush(void)
{
int len;
if (out_pos != 0)
{
if (out_pos == 0)
return;
// set out_pos to 0 before ui_write, to avoid recursiveness
len = out_pos;
out_pos = 0;
@@ -2733,7 +2735,6 @@ out_flush(void)
}
#endif
}
}
/*
* out_flush_cursor(): flush the output buffer and redraw the cursor.
@@ -2846,8 +2847,9 @@ out_str_nf(char_u *s)
void
out_str_cf(char_u *s)
{
if (s != NULL && *s)
{
if (s == NULL || *s == NUL)
return;
#ifdef HAVE_TGETENT
char_u *p;
#endif
@@ -2906,7 +2908,6 @@ out_str_cf(char_u *s)
if (p_wd)
out_flush();
}
}
/*
* out_str(s): Put a character string a byte at a time into the output buffer.
@@ -2917,8 +2918,9 @@ out_str_cf(char_u *s)
void
out_str(char_u *s)
{
if (s != NULL && *s)
{
if (s == NULL || *s == NUL)
return;
#ifdef FEAT_GUI
// Don't use tputs() when GUI is used, ncurses crashes.
if (gui.in_use)
@@ -2941,7 +2943,6 @@ out_str(char_u *s)
if (p_wd)
out_flush();
}
}
/*
* cursor positioning using termcap parser. (jw)
@@ -3468,14 +3469,13 @@ get_long_from_buf(char_u *buf, long_u *val)
*val = 0;
len = get_bytes_from_buf(buf, bytes, (int)sizeof(long_u));
if (len != -1)
{
if (len == -1)
return -1;
for (i = 0; i < (int)sizeof(long_u); i++)
{
shift = 8 * (sizeof(long_u) - 1 - i);
*val += (long_u)bytes[i] << shift;
}
}
return len;
}
#endif
@@ -3598,20 +3598,20 @@ shell_resized_check(void)
int old_Rows = Rows;
int old_Columns = Columns;
if (!exiting
if (exiting
#ifdef FEAT_GUI
// Do not get the size when executing a shell command during
// startup.
&& !gui.starting
|| gui.starting
#endif
)
{
return;
(void)ui_get_shellsize();
check_shellsize();
if (old_Rows != Rows || old_Columns != Columns)
shell_resized();
}
}
/*
* Set size of the Vim shell.
@@ -3843,8 +3843,9 @@ settmode(tmode_T tmode)
return;
#endif
if (full_screen)
{
if (!full_screen)
return;
/*
* When returning after calling a shell cur_tmode is TMODE_UNKNOWN,
* set the terminal to raw mode, even though we think it already is,
@@ -3902,13 +3903,13 @@ settmode(tmode_T tmode)
may_req_termresponse();
#endif
}
}
void
starttermcap(void)
{
if (full_screen && !termcap_active)
{
if (!full_screen || termcap_active)
return;
MAY_WANT_TO_LOG_THIS;
out_str(T_TI); // start termcap mode
@@ -3938,15 +3939,16 @@ starttermcap(void)
}
#endif
}
}
void
stoptermcap(void)
{
screen_stop_highlight();
reset_cterm_colors();
if (termcap_active)
{
if (!termcap_active)
return;
#ifdef FEAT_TERMRESPONSE
# ifdef FEAT_GUI
if (!gui.in_use && !gui.starting)
@@ -4002,7 +4004,6 @@ stoptermcap(void)
screen_start(); // don't know where cursor is now
out_flush();
}
}
#if defined(FEAT_TERMRESPONSE) || defined(PROTO)
/*
@@ -4219,14 +4220,14 @@ swapping_screen(void)
void
scroll_start(void)
{
if (*T_VS != NUL && *T_CVS != NUL)
{
if (*T_VS == NUL || *T_CVS == NUL)
return;
MAY_WANT_TO_LOG_THIS;
out_str(T_VS);
out_str(T_CVS);
screen_start(); // don't know where cursor is now
}
}
// True if cursor is not visible
static int cursor_is_off = FALSE;
@@ -4355,14 +4356,14 @@ term_cursor_mode(int forced)
void
term_cursor_color(char_u *color)
{
if (*T_CSC != NUL)
{
if (*T_CSC == NUL)
return;
out_str(T_CSC); // set cursor color start
out_str_nf(color);
out_str(T_CEC); // set cursor color end
out_flush();
}
}
# endif
int
@@ -4922,8 +4923,9 @@ modifiers2keycode(int modifiers, int *key, char_u *string)
{
int new_slen = 0;
if (modifiers != 0)
{
if (modifiers == 0)
return 0;
// Some keys have the modifier included. Need to handle that here to
// make mappings work. This may result in a special key, such as
// K_S_TAB.
@@ -4934,7 +4936,6 @@ modifiers2keycode(int modifiers, int *key, char_u *string)
string[new_slen++] = (int)KS_MODIFIER;
string[new_slen++] = modifiers;
}
}
return new_slen;
}
@@ -6523,13 +6524,13 @@ check_termcode(
void
term_get_fg_color(char_u *r, char_u *g, char_u *b)
{
if (rfg_status.tr_progress == STATUS_GOT)
{
if (rfg_status.tr_progress != STATUS_GOT)
return;
*r = fg_r;
*g = fg_g;
*b = fg_b;
}
}
/*
* Get the text background color, if known.
@@ -6537,13 +6538,13 @@ term_get_fg_color(char_u *r, char_u *g, char_u *b)
void
term_get_bg_color(char_u *r, char_u *g, char_u *b)
{
if (rbg_status.tr_progress == STATUS_GOT)
{
if (rbg_status.tr_progress != STATUS_GOT)
return;
*r = bg_r;
*g = bg_g;
*b = bg_b;
}
}
#endif
/*
@@ -7283,15 +7284,14 @@ find_first_tcap(
int code)
{
tcap_entry_T *p = find_builtin_term(name);
if (p != NULL)
{
if (p == NULL)
return NULL;
while (p->bt_string != NULL)
{
if (p->bt_entry == code)
return p;
++p;
}
}
return NULL;
}
# endif

View File

@@ -259,8 +259,9 @@ parse_termwinsize(win_T *wp, int *rows, int *cols)
*rows = 0;
*cols = 0;
if (*wp->w_p_tws != NUL)
{
if (*wp->w_p_tws == NUL)
return FALSE;
char_u *p = vim_strchr(wp->w_p_tws, 'x');
// Syntax of value was already checked when it's set.
@@ -271,7 +272,6 @@ parse_termwinsize(win_T *wp, int *rows, int *cols)
}
*rows = atoi((char *)wp->w_p_tws);
*cols = atoi((char *)p + 1);
}
return minsize;
}
@@ -1620,10 +1620,11 @@ term_job_running_check(term_T *term, int check_job_status)
{
// Also consider the job finished when the channel is closed, to avoid a
// race condition when updating the title.
if (term != NULL
&& term->tl_job != NULL
&& channel_is_open(term->tl_job->jv_channel))
{
if (term == NULL
|| term->tl_job == NULL
|| !channel_is_open(term->tl_job->jv_channel))
return FALSE;
job_T *job = term->tl_job;
// Careful: Checking the job status may invoke callbacks, which close
@@ -1634,8 +1635,6 @@ term_job_running_check(term_T *term, int check_job_status)
return (job->jv_status == JOB_STARTED
|| (job->jv_channel != NULL && job->jv_channel->ch_keep_open));
}
return FALSE;
}
/*
* Return TRUE if the job for "term" is still running.
@@ -1807,8 +1806,9 @@ equal_celattr(cellattr_T *a, cellattr_T *b)
static int
add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum)
{
if (ga_grow(&term->tl_scrollback, 1) == OK)
{
if (ga_grow(&term->tl_scrollback, 1) == FAIL)
return FALSE;
sb_line_T *line = (sb_line_T *)term->tl_scrollback.ga_data
+ term->tl_scrollback.ga_len;
@@ -1828,8 +1828,6 @@ add_empty_scrollback(term_T *term, cellattr_T *fill_attr, int lnum)
++term->tl_scrollback.ga_len;
return OK;
}
return FALSE;
}
/*
* Remove the terminal contents from the scrollback and the buffer.
@@ -2409,8 +2407,9 @@ term_paste_register(int prev_c UNUSED)
return;
l = (list_T *)get_reg_contents(c, GREG_LIST);
if (l != NULL)
{
if (l == NULL)
return;
type = get_reg_type(c, &reglen);
FOR_ALL_LIST_ITEMS(l, item)
{
@@ -2446,7 +2445,6 @@ term_paste_register(int prev_c UNUSED)
}
list_free(l);
}
}
/*
* Return TRUE when waiting for a character in the terminal, the cursor of the
@@ -2615,8 +2613,9 @@ term_win_entered()
{
term_T *term = curbuf->b_term;
if (term != NULL)
{
if (term == NULL)
return;
if (term_use_loop_check(TRUE))
{
reset_VIsual_and_resel();
@@ -2627,15 +2626,15 @@ term_win_entered()
enter_mouse_col = mouse_col;
enter_mouse_row = mouse_row;
}
}
void
term_focus_change(int in_focus)
{
term_T *term = curbuf->b_term;
if (term != NULL && term->tl_vterm != NULL)
{
if (term == NULL || term->tl_vterm == NULL)
return;
VTermState *state = vterm_obtain_state(term->tl_vterm);
if (in_focus)
@@ -2644,7 +2643,6 @@ term_focus_change(int in_focus)
vterm_state_focus_out(state);
term_forward_output(term);
}
}
/*
* vgetc() may not include CTRL in the key when modify_other_keys is set.
@@ -2886,14 +2884,14 @@ theend:
static void
may_toggle_cursor(term_T *term)
{
if (in_terminal_loop == term)
{
if (in_terminal_loop != term)
return;
if (term->tl_cursor_visible)
cursor_on();
else
cursor_off();
}
}
/*
* Reverse engineer the RGB value into a cterm color index.
@@ -3320,8 +3318,9 @@ handle_resize(int rows, int cols, void *user)
static void
limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
{
if (gap->ga_len >= term->tl_buffer->b_p_twsl)
{
if (gap->ga_len < term->tl_buffer->b_p_twsl)
return;
int todo = term->tl_buffer->b_p_twsl / 10;
int i;
@@ -3341,7 +3340,6 @@ limit_scrollback(term_T *term, garray_T *gap, int update_buffer)
if (update_buffer)
term->tl_scrollback_scrolled -= todo;
}
}
/*
* Handle a line that is pushed off the top of the screen.
@@ -3371,8 +3369,9 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
limit_scrollback(term, gap, update_buffer);
if (ga_grow(gap, 1) == OK)
{
if (ga_grow(gap, 1) == FAIL)
return 0;
cellattr_T *p = NULL;
int len = 0;
int i;
@@ -3442,7 +3441,6 @@ handle_pushline(int cols, const VTermScreenCell *cells, void *user)
ga_init(&ga); // text is kept in tl_scrollback_postponed
}
++gap->ga_len;
}
return 0; // ignored
}
@@ -3612,9 +3610,10 @@ term_after_channel_closed(term_T *term)
int
may_close_term_popup(void)
{
if (popup_is_popup(curwin) && curbuf->b_term != NULL
&& !term_job_running_not_none(curbuf->b_term))
{
if (!popup_is_popup(curwin) || curbuf->b_term == NULL
|| term_job_running_not_none(curbuf->b_term))
return FAIL;
win_T *pwin = curwin;
if (win_valid(prevwin))
@@ -3622,8 +3621,6 @@ may_close_term_popup(void)
popup_close_with_retval(pwin, 0);
return OK;
}
return FAIL;
}
#endif
/*
@@ -4002,13 +3999,13 @@ term_did_update_window(win_T *wp)
{
term_T *term = wp->w_buffer->b_term;
if (term != NULL && term->tl_vterm != NULL && !term->tl_normal_mode
&& wp->w_redr_type == 0)
{
if (term == NULL || term->tl_vterm == NULL || term->tl_normal_mode
|| wp->w_redr_type != 0)
return;
term->tl_dirty_row_start = MAX_ROW;
term->tl_dirty_row_end = 0;
}
}
/*
* Return TRUE if "wp" is a terminal window where the job has finished.
@@ -4040,8 +4037,9 @@ term_change_in_curbuf(void)
{
term_T *term = curbuf->b_term;
if (term_is_finished(curbuf) && term->tl_scrollback.ga_len > 0)
{
if (!term_is_finished(curbuf) || term->tl_scrollback.ga_len <= 0)
return;
free_scrollback(term);
redraw_buf_later(term->tl_buffer, UPD_NOT_VALID);
@@ -4050,7 +4048,6 @@ term_change_in_curbuf(void)
set_string_option_direct((char_u *)"buftype", -1,
(char_u *)"", OPT_FREE|OPT_LOCAL, 0);
}
}
/*
* Get the screen attribute for a position in the buffer.
@@ -4908,8 +4905,9 @@ term_update_colors_all(void)
char_u *
term_get_status_text(term_T *term)
{
if (term->tl_status_text == NULL)
{
if (term->tl_status_text != NULL)
return term->tl_status_text;
char_u *txt;
size_t len;
char_u *fname;
@@ -4935,7 +4933,6 @@ term_get_status_text(term_T *term)
if (term->tl_status_text != NULL)
vim_snprintf((char *)term->tl_status_text, len, "%s [%s]",
fname, txt);
}
return term->tl_status_text;
}
@@ -5236,12 +5233,12 @@ dump_is_corrupt(garray_T *gap)
static void
append_cell(garray_T *gap, cellattr_T *cell)
{
if (ga_grow(gap, 1) == OK)
{
if (ga_grow(gap, 1) == FAIL)
return;
*(((cellattr_T *)gap->ga_data) + gap->ga_len) = *cell;
++gap->ga_len;
}
}
static void
clear_cellattr(cellattr_T *cell)
@@ -6036,8 +6033,9 @@ f_term_getcursor(typval_T *argvars, typval_T *rettv)
list_append_number(l, term->tl_cursor_pos.col + 1);
d = dict_alloc();
if (d != NULL)
{
if (d == NULL)
return;
dict_add_number(d, "visible", term->tl_cursor_visible);
dict_add_number(d, "blink", blink_state_is_inverted()
? !term->tl_cursor_blink : term->tl_cursor_blink);
@@ -6045,7 +6043,6 @@ f_term_getcursor(typval_T *argvars, typval_T *rettv)
dict_add_string(d, "color", cursor_color_get(term->tl_cursor_color));
list_append_dict(l, d);
}
}
/*
* "term_getjob(buf)" function
@@ -7692,8 +7689,9 @@ term_free_vterm(term_T *term)
term_report_winsize(term_T *term, int rows, int cols)
{
// Use an ioctl() to report the new window size to the job.
if (term->tl_job != NULL && term->tl_job->jv_channel != NULL)
{
if (term->tl_job == NULL || term->tl_job->jv_channel == NULL)
return;
int fd = -1;
int part;
@@ -7706,7 +7704,6 @@ term_report_winsize(term_T *term, int rows, int cols)
if (part < PART_COUNT && mch_report_winsize(fd, rows, cols) == OK)
mch_signal_job(term->tl_job, (char_u *)"winch");
}
}
# endif

View File

@@ -55,8 +55,10 @@ ga_concat_esc(garray_T *gap, char_u *p, int clen)
mch_memmove(buf, p, clen);
buf[clen] = NUL;
ga_concat(gap, buf);
return;
}
else switch (*p)
switch (*p)
{
case BS: ga_concat(gap, (char_u *)"\\b"); break;
case ESC: ga_concat(gap, (char_u *)"\\e"); break;

View File

@@ -752,8 +752,9 @@ check_auto_format(
int c = ' ';
int cc;
if (did_add_space)
{
if (!did_add_space)
return;
cc = gchar_cursor();
if (!WHITECHAR(cc))
// Somehow the space was removed already.
@@ -774,7 +775,6 @@ check_auto_format(
}
}
}
}
/*
* Find out textwidth to be used for formatting:

View File

@@ -1939,8 +1939,9 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
}
hi = find_prop_type_hi(name, buf);
if (hi != NULL)
{
if (hi == NULL)
return;
hashtab_T *ht;
proptype_T *prop = HI2PT(hi);
@@ -1961,7 +1962,6 @@ f_prop_type_delete(typval_T *argvars, typval_T *rettv UNUSED)
redraw_all_later(UPD_CLEAR);
changed_window_setting_buf(buf == NULL ? curbuf : buf);
}
}
/*
* prop_type_get({name} [, {props}])
@@ -1982,8 +1982,10 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
semsg(_(e_invalid_argument_str), "\"\"");
return;
}
if (rettv_dict_alloc(rettv) == OK)
{
if (rettv_dict_alloc(rettv) == FAIL)
return;
proptype_T *prop = NULL;
buf_T *buf = NULL;
@@ -1994,8 +1996,9 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
}
prop = find_prop_type(name, buf);
if (prop != NULL)
{
if (prop == NULL)
return;
dict_T *d = rettv->vval.v_dict;
if (prop->pt_hl_id > 0)
@@ -2010,8 +2013,6 @@ f_prop_type_get(typval_T *argvars, typval_T *rettv)
if (buf != NULL)
dict_add_number(d, "bufnr", buf->b_fnum);
}
}
}
static void
list_types(hashtab_T *ht, list_T *l)
@@ -2040,8 +2041,9 @@ f_prop_type_list(typval_T *argvars, typval_T *rettv UNUSED)
{
buf_T *buf = NULL;
if (rettv_list_alloc(rettv) == OK)
{
if (rettv_list_alloc(rettv) == FAIL)
return;
if (in_vim9script() && check_for_opt_dict_arg(argvars, 0) == FAIL)
return;
@@ -2058,7 +2060,6 @@ f_prop_type_list(typval_T *argvars, typval_T *rettv UNUSED)
else if (buf->b_proptypes != NULL)
list_types(buf->b_proptypes, rettv->vval.v_list);
}
}
/*
* Free all property types in "ht".

View File

@@ -302,9 +302,11 @@ f_strftime(typval_T *argvars, typval_T *rettv)
curtime = vim_localtime(&seconds, &tmval);
// MSVC returns NULL for an invalid value of seconds.
if (curtime == NULL)
rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)"));
else
{
rettv->vval.v_string = vim_strsave((char_u *)_("(Invalid)"));
return;
}
# ifdef MSWIN
WCHAR result_buf[256];
WCHAR *wp;
@@ -343,7 +345,6 @@ f_strftime(typval_T *argvars, typval_T *rettv)
vim_free(enc);
# endif
}
}
# endif
# if defined(HAVE_STRPTIME) || defined(PROTO)
@@ -672,12 +673,12 @@ find_timer(long id)
{
timer_T *timer;
if (id >= 0)
{
if (id < 0)
return NULL;
FOR_ALL_TIMERS(timer)
if (timer->tr_id == id)
return timer;
}
return NULL;
}
@@ -791,7 +792,9 @@ timer_valid(timer_T *timer)
{
if (timer == NULL)
return FALSE;
for (timer_T *t = first_timer; t != NULL; t = t->tr_next)
timer_T *t;
FOR_ALL_TIMERS(t)
if (t == timer)
return TRUE;
return FALSE;
@@ -848,16 +851,17 @@ f_timer_pause(typval_T *argvars, typval_T *rettv UNUSED)
return;
if (argvars[0].v_type != VAR_NUMBER)
emsg(_(e_number_expected));
else
{
emsg(_(e_number_expected));
return;
}
int paused = (int)tv_get_bool(&argvars[1]);
timer = find_timer((int)tv_get_number(&argvars[0]));
if (timer != NULL)
timer->tr_paused = paused;
}
}
/*
* "timer_start(time, callback [, options])" function
@@ -904,15 +908,15 @@ f_timer_start(typval_T *argvars, typval_T *rettv)
timer = create_timer(msec, repeat);
if (timer == NULL)
free_callback(&callback);
else
{
free_callback(&callback);
return;
}
set_callback(&timer->tr_callback, &callback);
if (callback.cb_free_name)
vim_free(callback.cb_name);
rettv->vval.v_number = (varnumber_T)timer->tr_id;
}
}
/*
* "timer_stop(timer)" function
@@ -1019,8 +1023,9 @@ time_msg(
static struct timeval start;
struct timeval now;
if (time_fd != NULL)
{
if (time_fd == NULL)
return;
if (strstr(mesg, "STARTING") != NULL)
{
gettimeofday(&start, NULL);
@@ -1041,7 +1046,6 @@ time_msg(
prev_timeval = now;
fprintf(time_fd, ": %s\n", mesg);
}
}
# endif // STARTUPTIME
#endif // FEAT_EVAL

View File

@@ -52,8 +52,9 @@ alloc_string_tv(char_u *s)
void
free_tv(typval_T *varp)
{
if (varp != NULL)
{
if (varp == NULL)
return;
switch (varp->v_type)
{
case VAR_FUNC:
@@ -103,7 +104,6 @@ free_tv(typval_T *varp)
}
vim_free(varp);
}
}
/*
* Free the memory for a variable value and set the value to NULL or 0.
@@ -111,8 +111,9 @@ free_tv(typval_T *varp)
void
clear_tv(typval_T *varp)
{
if (varp != NULL)
{
if (varp == NULL)
return;
switch (varp->v_type)
{
case VAR_FUNC:
@@ -175,7 +176,6 @@ clear_tv(typval_T *varp)
}
varp->v_lock = 0;
}
}
/*
* Set the value of a variable to NULL without freeing items.

View File

@@ -695,6 +695,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1245,
/**/
1244,
/**/