mirror of
https://github.com/neovim/neovim.git
synced 2025-09-21 18:58:18 +00:00
Merge pull request #1478 from elmart/clang-analysis-fixes-4
Fix clang analysis warnings. (4)
This commit is contained in:
@@ -178,6 +178,8 @@ static char *e_nofunc = N_("E130: Unknown function: %s");
|
|||||||
static char *e_illvar = N_("E461: Illegal variable name: %s");
|
static char *e_illvar = N_("E461: Illegal variable name: %s");
|
||||||
static char *e_float_as_string = N_("E806: using Float as a String");
|
static char *e_float_as_string = N_("E806: using Float as a String");
|
||||||
|
|
||||||
|
static char_u * const empty_string = (char_u *)"";
|
||||||
|
|
||||||
static dictitem_T globvars_var; /* variable used for g: */
|
static dictitem_T globvars_var; /* variable used for g: */
|
||||||
#define globvarht globvardict.dv_hashtab
|
#define globvarht globvardict.dv_hashtab
|
||||||
|
|
||||||
@@ -2272,6 +2274,7 @@ static void set_var_lval(lval_T *lp, char_u *endp, typval_T *rettv, int copy, ch
|
|||||||
if (lp->ll_li->li_next == NULL) {
|
if (lp->ll_li->li_next == NULL) {
|
||||||
/* Need to add an empty item. */
|
/* Need to add an empty item. */
|
||||||
list_append_number(lp->ll_list, 0);
|
list_append_number(lp->ll_list, 0);
|
||||||
|
assert(lp->ll_li->li_next);
|
||||||
}
|
}
|
||||||
lp->ll_li = lp->ll_li->li_next;
|
lp->ll_li = lp->ll_li->li_next;
|
||||||
++lp->ll_n1;
|
++lp->ll_n1;
|
||||||
@@ -4123,7 +4126,7 @@ eval7 (
|
|||||||
* get_func_tv, but it's needed in handle_subscript() to parse
|
* get_func_tv, but it's needed in handle_subscript() to parse
|
||||||
* what follows. So set it here. */
|
* what follows. So set it here. */
|
||||||
if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') {
|
if (rettv->v_type == VAR_UNKNOWN && !evaluate && **arg == '(') {
|
||||||
rettv->vval.v_string = (char_u *)"";
|
rettv->vval.v_string = empty_string;
|
||||||
rettv->v_type = VAR_FUNC;
|
rettv->v_type = VAR_FUNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5733,7 +5736,9 @@ dict_free (
|
|||||||
dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET
|
dictitem_T *dictitem_alloc(char_u *key) FUNC_ATTR_NONNULL_RET
|
||||||
{
|
{
|
||||||
dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(key));
|
dictitem_T *di = xmalloc(sizeof(dictitem_T) + STRLEN(key));
|
||||||
|
#ifndef __clang_analyzer__
|
||||||
STRCPY(di->di_key, key);
|
STRCPY(di->di_key, key);
|
||||||
|
#endif
|
||||||
di->di_flags = 0;
|
di->di_flags = 0;
|
||||||
return di;
|
return di;
|
||||||
}
|
}
|
||||||
@@ -12518,6 +12523,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv)
|
|||||||
{
|
{
|
||||||
rettv->v_type = VAR_NUMBER;
|
rettv->v_type = VAR_NUMBER;
|
||||||
rettv->vval.v_number = 0;
|
rettv->vval.v_number = 0;
|
||||||
|
const int l_provider_call_nesting = provider_call_nesting;
|
||||||
|
|
||||||
if (check_restricted() || check_secure()) {
|
if (check_restricted() || check_secure()) {
|
||||||
return;
|
return;
|
||||||
@@ -12545,7 +12551,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv)
|
|||||||
int save_autocmd_fname_full, save_autocmd_bufnr;
|
int save_autocmd_fname_full, save_autocmd_bufnr;
|
||||||
void *save_funccalp;
|
void *save_funccalp;
|
||||||
|
|
||||||
if (provider_call_nesting) {
|
if (l_provider_call_nesting) {
|
||||||
// If this is called from a provider function, restore the scope
|
// If this is called from a provider function, restore the scope
|
||||||
// information of the caller.
|
// information of the caller.
|
||||||
save_current_SID = current_SID;
|
save_current_SID = current_SID;
|
||||||
@@ -12574,7 +12580,7 @@ static void f_rpcrequest(typval_T *argvars, typval_T *rettv)
|
|||||||
args,
|
args,
|
||||||
&err);
|
&err);
|
||||||
|
|
||||||
if (provider_call_nesting) {
|
if (l_provider_call_nesting) {
|
||||||
current_SID = save_current_SID;
|
current_SID = save_current_SID;
|
||||||
sourcing_name = save_sourcing_name;
|
sourcing_name = save_sourcing_name;
|
||||||
sourcing_lnum = save_sourcing_lnum;
|
sourcing_lnum = save_sourcing_lnum;
|
||||||
@@ -13542,13 +13548,12 @@ static bool item_compare_numeric;
|
|||||||
static char_u *item_compare_func;
|
static char_u *item_compare_func;
|
||||||
static dict_T *item_compare_selfdict;
|
static dict_T *item_compare_selfdict;
|
||||||
static int item_compare_func_err;
|
static int item_compare_func_err;
|
||||||
static bool item_compare_keep_zero;
|
|
||||||
#define ITEM_COMPARE_FAIL 999
|
#define ITEM_COMPARE_FAIL 999
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Compare functions for f_sort() and f_uniq() below.
|
* Compare functions for f_sort() and f_uniq() below.
|
||||||
*/
|
*/
|
||||||
static int item_compare(const void *s1, const void *s2)
|
static int item_compare(const void *s1, const void *s2, bool keep_zero)
|
||||||
{
|
{
|
||||||
sortItem_T *si1, *si2;
|
sortItem_T *si1, *si2;
|
||||||
char_u *p1, *p2;
|
char_u *p1, *p2;
|
||||||
@@ -13601,7 +13606,7 @@ static int item_compare(const void *s1, const void *s2)
|
|||||||
|
|
||||||
// When the result would be zero, compare the item indexes. Makes the
|
// When the result would be zero, compare the item indexes. Makes the
|
||||||
// sort stable.
|
// sort stable.
|
||||||
if (res == 0 && !item_compare_keep_zero) {
|
if (res == 0 && !keep_zero) {
|
||||||
res = si1->idx > si2->idx ? 1 : -1;
|
res = si1->idx > si2->idx ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -13610,7 +13615,17 @@ static int item_compare(const void *s1, const void *s2)
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int item_compare2(const void *s1, const void *s2)
|
static int item_compare_keeping_zero(const void *s1, const void *s2)
|
||||||
|
{
|
||||||
|
return item_compare(s1, s2, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int item_compare_not_keeping_zero(const void *s1, const void *s2)
|
||||||
|
{
|
||||||
|
return item_compare(s1, s2, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int item_compare2(const void *s1, const void *s2, bool keep_zero)
|
||||||
{
|
{
|
||||||
sortItem_T *si1, *si2;
|
sortItem_T *si1, *si2;
|
||||||
int res;
|
int res;
|
||||||
@@ -13647,13 +13662,23 @@ static int item_compare2(const void *s1, const void *s2)
|
|||||||
|
|
||||||
// When the result would be zero, compare the pointers themselves. Makes
|
// When the result would be zero, compare the pointers themselves. Makes
|
||||||
// the sort stable.
|
// the sort stable.
|
||||||
if (res == 0 && !item_compare_keep_zero) {
|
if (res == 0 && !keep_zero) {
|
||||||
res = si1->idx > si2->idx ? 1 : -1;
|
res = si1->idx > si2->idx ? 1 : -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int item_compare2_keeping_zero(const void *s1, const void *s2)
|
||||||
|
{
|
||||||
|
return item_compare2(s1, s2, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int item_compare2_not_keeping_zero(const void *s1, const void *s2)
|
||||||
|
{
|
||||||
|
return item_compare2(s1, s2, false);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "sort({list})" function
|
* "sort({list})" function
|
||||||
*/
|
*/
|
||||||
@@ -13734,15 +13759,16 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
|
|||||||
}
|
}
|
||||||
|
|
||||||
item_compare_func_err = FALSE;
|
item_compare_func_err = FALSE;
|
||||||
item_compare_keep_zero = false;
|
|
||||||
// Test the compare function.
|
// Test the compare function.
|
||||||
if (item_compare_func != NULL
|
if (item_compare_func != NULL
|
||||||
&& item_compare2(&ptrs[0], &ptrs[1]) == ITEM_COMPARE_FAIL) {
|
&& item_compare2_not_keeping_zero(&ptrs[0], &ptrs[1])
|
||||||
|
== ITEM_COMPARE_FAIL) {
|
||||||
EMSG(_("E702: Sort compare function failed"));
|
EMSG(_("E702: Sort compare function failed"));
|
||||||
} else {
|
} else {
|
||||||
// Sort the array with item pointers.
|
// Sort the array with item pointers.
|
||||||
qsort(ptrs, (size_t)len, sizeof (sortItem_T),
|
qsort(ptrs, (size_t)len, sizeof (sortItem_T),
|
||||||
item_compare_func == NULL ? item_compare : item_compare2);
|
item_compare_func == NULL ? item_compare_not_keeping_zero :
|
||||||
|
item_compare2_not_keeping_zero);
|
||||||
|
|
||||||
if (!item_compare_func_err) {
|
if (!item_compare_func_err) {
|
||||||
// Clear the list and append the items in the sorted order.
|
// Clear the list and append the items in the sorted order.
|
||||||
@@ -13761,8 +13787,8 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
|
|||||||
|
|
||||||
// f_uniq(): ptrs will be a stack of items to remove.
|
// f_uniq(): ptrs will be a stack of items to remove.
|
||||||
item_compare_func_err = FALSE;
|
item_compare_func_err = FALSE;
|
||||||
item_compare_keep_zero = true;
|
item_compare_func_ptr = item_compare_func ? item_compare2_keeping_zero :
|
||||||
item_compare_func_ptr = item_compare_func ? item_compare2 : item_compare;
|
item_compare_keeping_zero;
|
||||||
|
|
||||||
for (li = l->lv_first; li != NULL && li->li_next != NULL; li = li->li_next) {
|
for (li = l->lv_first; li != NULL && li->li_next != NULL; li = li->li_next) {
|
||||||
if (item_compare_func_ptr(&li, &li->li_next) == 0) {
|
if (item_compare_func_ptr(&li, &li->li_next) == 0) {
|
||||||
@@ -13776,6 +13802,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
|
|||||||
|
|
||||||
if (!item_compare_func_err) {
|
if (!item_compare_func_err) {
|
||||||
while (--i >= 0) {
|
while (--i >= 0) {
|
||||||
|
assert(ptrs[i].item->li_next);
|
||||||
li = ptrs[i].item->li_next;
|
li = ptrs[i].item->li_next;
|
||||||
ptrs[i].item->li_next = li->li_next;
|
ptrs[i].item->li_next = li->li_next;
|
||||||
if (li->li_next != NULL) {
|
if (li->li_next != NULL) {
|
||||||
@@ -16111,7 +16138,11 @@ void clear_tv(typval_T *varp)
|
|||||||
switch (varp->v_type) {
|
switch (varp->v_type) {
|
||||||
case VAR_FUNC:
|
case VAR_FUNC:
|
||||||
func_unref(varp->vval.v_string);
|
func_unref(varp->vval.v_string);
|
||||||
/*FALLTHROUGH*/
|
if (varp->vval.v_string != empty_string) {
|
||||||
|
free(varp->vval.v_string);
|
||||||
|
}
|
||||||
|
varp->vval.v_string = NULL;
|
||||||
|
break;
|
||||||
case VAR_STRING:
|
case VAR_STRING:
|
||||||
free(varp->vval.v_string);
|
free(varp->vval.v_string);
|
||||||
varp->vval.v_string = NULL;
|
varp->vval.v_string = NULL;
|
||||||
@@ -18250,6 +18281,7 @@ char_u *get_user_func_name(expand_T *xp, int idx)
|
|||||||
done = 0;
|
done = 0;
|
||||||
hi = func_hashtab.ht_array;
|
hi = func_hashtab.ht_array;
|
||||||
}
|
}
|
||||||
|
assert(hi);
|
||||||
if (done < func_hashtab.ht_used) {
|
if (done < func_hashtab.ht_used) {
|
||||||
if (done++ > 0)
|
if (done++ > 0)
|
||||||
++hi;
|
++hi;
|
||||||
@@ -18465,8 +18497,10 @@ call_user_func (
|
|||||||
/* Set l:self to "selfdict". Use "name" to avoid a warning from
|
/* Set l:self to "selfdict". Use "name" to avoid a warning from
|
||||||
* some compiler that checks the destination size. */
|
* some compiler that checks the destination size. */
|
||||||
v = &fc->fixvar[fixvar_idx++].var;
|
v = &fc->fixvar[fixvar_idx++].var;
|
||||||
|
#ifndef __clang_analyzer__
|
||||||
name = v->di_key;
|
name = v->di_key;
|
||||||
STRCPY(name, "self");
|
STRCPY(name, "self");
|
||||||
|
#endif
|
||||||
v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
|
v->di_flags = DI_FLAGS_RO + DI_FLAGS_FIX;
|
||||||
hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
|
hash_add(&fc->l_vars.dv_hashtab, DI2HIKEY(v));
|
||||||
v->di_tv.v_type = VAR_DICT;
|
v->di_tv.v_type = VAR_DICT;
|
||||||
@@ -18486,8 +18520,10 @@ call_user_func (
|
|||||||
/* Use "name" to avoid a warning from some compiler that checks the
|
/* Use "name" to avoid a warning from some compiler that checks the
|
||||||
* destination size. */
|
* destination size. */
|
||||||
v = &fc->fixvar[fixvar_idx++].var;
|
v = &fc->fixvar[fixvar_idx++].var;
|
||||||
|
#ifndef __clang_analyzer__
|
||||||
name = v->di_key;
|
name = v->di_key;
|
||||||
STRCPY(name, "000");
|
STRCPY(name, "000");
|
||||||
|
#endif
|
||||||
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||||
hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
|
hash_add(&fc->l_avars.dv_hashtab, DI2HIKEY(v));
|
||||||
v->di_tv.v_type = VAR_LIST;
|
v->di_tv.v_type = VAR_LIST;
|
||||||
@@ -18774,7 +18810,9 @@ free_funccal (
|
|||||||
*/
|
*/
|
||||||
static void add_nr_var(dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)
|
static void add_nr_var(dict_T *dp, dictitem_T *v, char *name, varnumber_T nr)
|
||||||
{
|
{
|
||||||
|
#ifndef __clang_analyzer__
|
||||||
STRCPY(v->di_key, name);
|
STRCPY(v->di_key, name);
|
||||||
|
#endif
|
||||||
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
v->di_flags = DI_FLAGS_RO | DI_FLAGS_FIX;
|
||||||
hash_add(&dp->dv_hashtab, DI2HIKEY(v));
|
hash_add(&dp->dv_hashtab, DI2HIKEY(v));
|
||||||
v->di_tv.v_type = VAR_NUMBER;
|
v->di_tv.v_type = VAR_NUMBER;
|
||||||
@@ -18864,8 +18902,10 @@ int do_return(exarg_T *eap, int reanimate, int is_cmd, void *rettv)
|
|||||||
else {
|
else {
|
||||||
/* When undoing a return in order to make it pending, get the stored
|
/* When undoing a return in order to make it pending, get the stored
|
||||||
* return rettv. */
|
* return rettv. */
|
||||||
if (reanimate)
|
if (reanimate) {
|
||||||
|
assert(current_funccal->rettv);
|
||||||
rettv = current_funccal->rettv;
|
rettv = current_funccal->rettv;
|
||||||
|
}
|
||||||
|
|
||||||
if (rettv != NULL) {
|
if (rettv != NULL) {
|
||||||
/* Store the value of the pending return. */
|
/* Store the value of the pending return. */
|
||||||
|
@@ -6301,6 +6301,8 @@ void screenalloc(bool doclear)
|
|||||||
static int entered = FALSE; /* avoid recursiveness */
|
static int entered = FALSE; /* avoid recursiveness */
|
||||||
static int done_outofmem_msg = FALSE; /* did outofmem message */
|
static int done_outofmem_msg = FALSE; /* did outofmem message */
|
||||||
int retry_count = 0;
|
int retry_count = 0;
|
||||||
|
const bool l_enc_utf8 = enc_utf8;
|
||||||
|
const int l_enc_dbcs = enc_dbcs;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
/*
|
/*
|
||||||
@@ -6311,8 +6313,8 @@ retry:
|
|||||||
if ((ScreenLines != NULL
|
if ((ScreenLines != NULL
|
||||||
&& Rows == screen_Rows
|
&& Rows == screen_Rows
|
||||||
&& Columns == screen_Columns
|
&& Columns == screen_Columns
|
||||||
&& enc_utf8 == (ScreenLinesUC != NULL)
|
&& l_enc_utf8 == (ScreenLinesUC != NULL)
|
||||||
&& (enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL)
|
&& (l_enc_dbcs == DBCS_JPNU) == (ScreenLines2 != NULL)
|
||||||
&& p_mco == Screen_mco
|
&& p_mco == Screen_mco
|
||||||
)
|
)
|
||||||
|| Rows == 0
|
|| Rows == 0
|
||||||
@@ -6358,13 +6360,13 @@ retry:
|
|||||||
|
|
||||||
new_ScreenLines = xmalloc((size_t)((Rows + 1) * Columns * sizeof(schar_T)));
|
new_ScreenLines = xmalloc((size_t)((Rows + 1) * Columns * sizeof(schar_T)));
|
||||||
memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO);
|
memset(new_ScreenLinesC, 0, sizeof(u8char_T *) * MAX_MCO);
|
||||||
if (enc_utf8) {
|
if (l_enc_utf8) {
|
||||||
new_ScreenLinesUC = xmalloc(
|
new_ScreenLinesUC = xmalloc(
|
||||||
(size_t)((Rows + 1) * Columns * sizeof(u8char_T)));
|
(size_t)((Rows + 1) * Columns * sizeof(u8char_T)));
|
||||||
for (i = 0; i < p_mco; ++i)
|
for (i = 0; i < p_mco; ++i)
|
||||||
new_ScreenLinesC[i] = xcalloc((Rows + 1) * Columns, sizeof(u8char_T));
|
new_ScreenLinesC[i] = xcalloc((Rows + 1) * Columns, sizeof(u8char_T));
|
||||||
}
|
}
|
||||||
if (enc_dbcs == DBCS_JPNU)
|
if (l_enc_dbcs == DBCS_JPNU)
|
||||||
new_ScreenLines2 = xmalloc(
|
new_ScreenLines2 = xmalloc(
|
||||||
(size_t)((Rows + 1) * Columns * sizeof(schar_T)));
|
(size_t)((Rows + 1) * Columns * sizeof(schar_T)));
|
||||||
new_ScreenAttrs = xmalloc((size_t)((Rows + 1) * Columns * sizeof(sattr_T)));
|
new_ScreenAttrs = xmalloc((size_t)((Rows + 1) * Columns * sizeof(sattr_T)));
|
||||||
@@ -6383,8 +6385,8 @@ retry:
|
|||||||
if (new_ScreenLinesC[i] == NULL)
|
if (new_ScreenLinesC[i] == NULL)
|
||||||
break;
|
break;
|
||||||
if (new_ScreenLines == NULL
|
if (new_ScreenLines == NULL
|
||||||
|| (enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
|
|| (l_enc_utf8 && (new_ScreenLinesUC == NULL || i != p_mco))
|
||||||
|| (enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
|
|| (l_enc_dbcs == DBCS_JPNU && new_ScreenLines2 == NULL)
|
||||||
|| new_ScreenAttrs == NULL
|
|| new_ScreenAttrs == NULL
|
||||||
|| new_LineOffset == NULL
|
|| new_LineOffset == NULL
|
||||||
|| new_LineWraps == NULL
|
|| new_LineWraps == NULL
|
||||||
@@ -6432,7 +6434,7 @@ retry:
|
|||||||
if (!doclear) {
|
if (!doclear) {
|
||||||
(void)memset(new_ScreenLines + new_row * Columns,
|
(void)memset(new_ScreenLines + new_row * Columns,
|
||||||
' ', (size_t)Columns * sizeof(schar_T));
|
' ', (size_t)Columns * sizeof(schar_T));
|
||||||
if (enc_utf8) {
|
if (l_enc_utf8) {
|
||||||
(void)memset(new_ScreenLinesUC + new_row * Columns,
|
(void)memset(new_ScreenLinesUC + new_row * Columns,
|
||||||
0, (size_t)Columns * sizeof(u8char_T));
|
0, (size_t)Columns * sizeof(u8char_T));
|
||||||
for (i = 0; i < p_mco; ++i)
|
for (i = 0; i < p_mco; ++i)
|
||||||
@@ -6440,7 +6442,7 @@ retry:
|
|||||||
+ new_row * Columns,
|
+ new_row * Columns,
|
||||||
0, (size_t)Columns * sizeof(u8char_T));
|
0, (size_t)Columns * sizeof(u8char_T));
|
||||||
}
|
}
|
||||||
if (enc_dbcs == DBCS_JPNU)
|
if (l_enc_dbcs == DBCS_JPNU)
|
||||||
(void)memset(new_ScreenLines2 + new_row * Columns,
|
(void)memset(new_ScreenLines2 + new_row * Columns,
|
||||||
0, (size_t)Columns * sizeof(schar_T));
|
0, (size_t)Columns * sizeof(schar_T));
|
||||||
(void)memset(new_ScreenAttrs + new_row * Columns,
|
(void)memset(new_ScreenAttrs + new_row * Columns,
|
||||||
@@ -6453,12 +6455,12 @@ retry:
|
|||||||
len = Columns;
|
len = Columns;
|
||||||
/* When switching to utf-8 don't copy characters, they
|
/* When switching to utf-8 don't copy characters, they
|
||||||
* may be invalid now. Also when p_mco changes. */
|
* may be invalid now. Also when p_mco changes. */
|
||||||
if (!(enc_utf8 && ScreenLinesUC == NULL)
|
if (!(l_enc_utf8 && ScreenLinesUC == NULL)
|
||||||
&& p_mco == Screen_mco)
|
&& p_mco == Screen_mco)
|
||||||
memmove(new_ScreenLines + new_LineOffset[new_row],
|
memmove(new_ScreenLines + new_LineOffset[new_row],
|
||||||
ScreenLines + LineOffset[old_row],
|
ScreenLines + LineOffset[old_row],
|
||||||
(size_t)len * sizeof(schar_T));
|
(size_t)len * sizeof(schar_T));
|
||||||
if (enc_utf8 && ScreenLinesUC != NULL
|
if (l_enc_utf8 && ScreenLinesUC != NULL
|
||||||
&& p_mco == Screen_mco) {
|
&& p_mco == Screen_mco) {
|
||||||
memmove(new_ScreenLinesUC + new_LineOffset[new_row],
|
memmove(new_ScreenLinesUC + new_LineOffset[new_row],
|
||||||
ScreenLinesUC + LineOffset[old_row],
|
ScreenLinesUC + LineOffset[old_row],
|
||||||
@@ -6469,7 +6471,7 @@ retry:
|
|||||||
ScreenLinesC[i] + LineOffset[old_row],
|
ScreenLinesC[i] + LineOffset[old_row],
|
||||||
(size_t)len * sizeof(u8char_T));
|
(size_t)len * sizeof(u8char_T));
|
||||||
}
|
}
|
||||||
if (enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
|
if (l_enc_dbcs == DBCS_JPNU && ScreenLines2 != NULL)
|
||||||
memmove(new_ScreenLines2 + new_LineOffset[new_row],
|
memmove(new_ScreenLines2 + new_LineOffset[new_row],
|
||||||
ScreenLines2 + LineOffset[old_row],
|
ScreenLines2 + LineOffset[old_row],
|
||||||
(size_t)len * sizeof(schar_T));
|
(size_t)len * sizeof(schar_T));
|
||||||
|
@@ -10,6 +10,7 @@
|
|||||||
* Code to handle tags and the tag stack
|
* Code to handle tags and the tag stack
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
@@ -2307,6 +2308,7 @@ jumpto_tag (
|
|||||||
win_T *curwin_save = NULL;
|
win_T *curwin_save = NULL;
|
||||||
char_u *full_fname = NULL;
|
char_u *full_fname = NULL;
|
||||||
int old_KeyTyped = KeyTyped; /* getting the file may reset it */
|
int old_KeyTyped = KeyTyped; /* getting the file may reset it */
|
||||||
|
const int l_g_do_tagpreview = g_do_tagpreview;
|
||||||
|
|
||||||
pbuf = xmalloc(LSIZE);
|
pbuf = xmalloc(LSIZE);
|
||||||
|
|
||||||
@@ -2363,7 +2365,7 @@ jumpto_tag (
|
|||||||
++RedrawingDisabled;
|
++RedrawingDisabled;
|
||||||
|
|
||||||
|
|
||||||
if (g_do_tagpreview != 0) {
|
if (l_g_do_tagpreview != 0) {
|
||||||
postponed_split = 0; /* don't split again below */
|
postponed_split = 0; /* don't split again below */
|
||||||
curwin_save = curwin; /* Save current window */
|
curwin_save = curwin; /* Save current window */
|
||||||
|
|
||||||
@@ -2395,7 +2397,7 @@ jumpto_tag (
|
|||||||
if (keep_help) {
|
if (keep_help) {
|
||||||
/* A :ta from a help file will keep the b_help flag set. For ":ptag"
|
/* A :ta from a help file will keep the b_help flag set. For ":ptag"
|
||||||
* we need to use the flag from the window where we came from. */
|
* we need to use the flag from the window where we came from. */
|
||||||
if (g_do_tagpreview != 0)
|
if (l_g_do_tagpreview != 0)
|
||||||
keep_help_flag = curwin_save->w_buffer->b_help;
|
keep_help_flag = curwin_save->w_buffer->b_help;
|
||||||
else
|
else
|
||||||
keep_help_flag = curbuf->b_help;
|
keep_help_flag = curbuf->b_help;
|
||||||
@@ -2541,7 +2543,7 @@ jumpto_tag (
|
|||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_do_tagpreview != 0
|
if (l_g_do_tagpreview != 0
|
||||||
&& curwin != curwin_save && win_valid(curwin_save)) {
|
&& curwin != curwin_save && win_valid(curwin_save)) {
|
||||||
/* Return cursor to where we were */
|
/* Return cursor to where we were */
|
||||||
validate_cursor();
|
validate_cursor();
|
||||||
@@ -2779,7 +2781,8 @@ int get_tags(list_T *list, char_u *pat)
|
|||||||
TAG_REGEXP | TAG_NOIC, (int)MAXCOL, NULL);
|
TAG_REGEXP | TAG_NOIC, (int)MAXCOL, NULL);
|
||||||
if (ret == OK && num_matches > 0) {
|
if (ret == OK && num_matches > 0) {
|
||||||
for (i = 0; i < num_matches; ++i) {
|
for (i = 0; i < num_matches; ++i) {
|
||||||
parse_match(matches[i], &tp);
|
int parse_result = parse_match(matches[i], &tp);
|
||||||
|
assert(parse_result == OK);
|
||||||
is_static = test_for_static(&tp);
|
is_static = test_for_static(&tp);
|
||||||
|
|
||||||
/* Skip pseudo-tag lines. */
|
/* Skip pseudo-tag lines. */
|
||||||
@@ -2796,7 +2799,7 @@ int get_tags(list_T *list, char_u *pat)
|
|||||||
|| add_tag_field(dict, "cmd", tp.command,
|
|| add_tag_field(dict, "cmd", tp.command,
|
||||||
tp.command_end) == FAIL
|
tp.command_end) == FAIL
|
||||||
|| add_tag_field(dict, "kind", tp.tagkind,
|
|| add_tag_field(dict, "kind", tp.tagkind,
|
||||||
tp.tagkind_end) == FAIL
|
tp.tagkind ? tp.tagkind_end : NULL) == FAIL
|
||||||
|| dict_add_nr_str(dict, "static", is_static, NULL) == FAIL)
|
|| dict_add_nr_str(dict, "static", is_static, NULL) == FAIL)
|
||||||
ret = FAIL;
|
ret = FAIL;
|
||||||
|
|
||||||
|
@@ -1230,7 +1230,6 @@ static void win_rotate(int upwards, int count)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Check if all frames in this row/col have one window. */
|
/* Check if all frames in this row/col have one window. */
|
||||||
for (frp = curwin->w_frame->fr_parent->fr_child; frp != NULL;
|
for (frp = curwin->w_frame->fr_parent->fr_child; frp != NULL;
|
||||||
frp = frp->fr_next)
|
frp = frp->fr_next)
|
||||||
@@ -1246,6 +1245,7 @@ static void win_rotate(int upwards, int count)
|
|||||||
wp1 = frp->fr_win;
|
wp1 = frp->fr_win;
|
||||||
win_remove(wp1, NULL);
|
win_remove(wp1, NULL);
|
||||||
frame_remove(frp);
|
frame_remove(frp);
|
||||||
|
assert(frp->fr_parent->fr_child);
|
||||||
|
|
||||||
/* find last frame and append removed window/frame after it */
|
/* find last frame and append removed window/frame after it */
|
||||||
for (; frp->fr_next != NULL; frp = frp->fr_next)
|
for (; frp->fr_next != NULL; frp = frp->fr_next)
|
||||||
@@ -1263,6 +1263,7 @@ static void win_rotate(int upwards, int count)
|
|||||||
wp2 = wp1->w_prev; /* will become last window */
|
wp2 = wp1->w_prev; /* will become last window */
|
||||||
win_remove(wp1, NULL);
|
win_remove(wp1, NULL);
|
||||||
frame_remove(frp);
|
frame_remove(frp);
|
||||||
|
assert(frp->fr_parent->fr_child);
|
||||||
|
|
||||||
/* append the removed window/frame before the first in the list */
|
/* append the removed window/frame before the first in the list */
|
||||||
win_append(frp->fr_parent->fr_child->fr_win->w_prev, wp1);
|
win_append(frp->fr_parent->fr_child->fr_win->w_prev, wp1);
|
||||||
@@ -2193,6 +2194,7 @@ winframe_remove (
|
|||||||
* the frames into this list. */
|
* the frames into this list. */
|
||||||
if (frp2->fr_child == frp)
|
if (frp2->fr_child == frp)
|
||||||
frp2->fr_child = frp->fr_child;
|
frp2->fr_child = frp->fr_child;
|
||||||
|
assert(frp->fr_child);
|
||||||
frp->fr_child->fr_prev = frp->fr_prev;
|
frp->fr_child->fr_prev = frp->fr_prev;
|
||||||
if (frp->fr_prev != NULL)
|
if (frp->fr_prev != NULL)
|
||||||
frp->fr_prev->fr_next = frp->fr_child;
|
frp->fr_prev->fr_next = frp->fr_child;
|
||||||
@@ -4502,6 +4504,7 @@ void win_drag_vsep_line(win_T *dragwin, int offset)
|
|||||||
room += fr->fr_width - frame_minwidth(fr, NULL);
|
room += fr->fr_width - frame_minwidth(fr, NULL);
|
||||||
fr = curfr; /* put fr at window that grows */
|
fr = curfr; /* put fr at window that grows */
|
||||||
}
|
}
|
||||||
|
assert(fr);
|
||||||
|
|
||||||
if (room < offset) /* Not enough room */
|
if (room < offset) /* Not enough room */
|
||||||
offset = room; /* Move as far as we can */
|
offset = room; /* Move as far as we can */
|
||||||
@@ -4973,6 +4976,7 @@ static void last_status_rec(frame_T *fr, int statusline)
|
|||||||
*/
|
*/
|
||||||
int tabline_height(void)
|
int tabline_height(void)
|
||||||
{
|
{
|
||||||
|
assert(first_tabpage);
|
||||||
switch (p_stal) {
|
switch (p_stal) {
|
||||||
case 0: return 0;
|
case 0: return 0;
|
||||||
case 1: return (first_tabpage->tp_next == NULL) ? 0 : 1;
|
case 1: return (first_tabpage->tp_next == NULL) ? 0 : 1;
|
||||||
|
Reference in New Issue
Block a user