mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 06:28:35 +00:00
refactor: follow style guide
- reduce variable scope - prefer initialization over declaration and assignment
This commit is contained in:
@@ -153,7 +153,6 @@ static void ga_concat_shorten_esc(garray_T *gap, const char *str)
|
||||
static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, const char *exp_str,
|
||||
typval_T *exp_tv_arg, typval_T *got_tv_arg, assert_type_T atype)
|
||||
{
|
||||
char *tofree;
|
||||
typval_T *exp_tv = exp_tv_arg;
|
||||
typval_T *got_tv = got_tv_arg;
|
||||
bool did_copy = false;
|
||||
@@ -163,7 +162,7 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, const char *e
|
||||
&& !(opt_msg_tv->v_type == VAR_STRING
|
||||
&& (opt_msg_tv->vval.v_string == NULL
|
||||
|| *opt_msg_tv->vval.v_string == NUL))) {
|
||||
tofree = encode_tv2echo(opt_msg_tv, NULL);
|
||||
char *tofree = encode_tv2echo(opt_msg_tv, NULL);
|
||||
ga_concat(gap, tofree);
|
||||
xfree(tofree);
|
||||
ga_concat(gap, ": ");
|
||||
@@ -224,7 +223,7 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, const char *e
|
||||
}
|
||||
}
|
||||
|
||||
tofree = encode_tv2string(exp_tv, NULL);
|
||||
char *tofree = encode_tv2string(exp_tv, NULL);
|
||||
ga_concat_shorten_esc(gap, tofree);
|
||||
xfree(tofree);
|
||||
} else {
|
||||
@@ -245,7 +244,7 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, const char *e
|
||||
} else {
|
||||
ga_concat(gap, " but got ");
|
||||
}
|
||||
tofree = encode_tv2string(got_tv, NULL);
|
||||
char *tofree = encode_tv2string(got_tv, NULL);
|
||||
ga_concat_shorten_esc(gap, tofree);
|
||||
xfree(tofree);
|
||||
|
||||
|
Reference in New Issue
Block a user