mirror of
https://github.com/neovim/neovim.git
synced 2025-10-26 12:27:24 +00:00
refactor: remove redundant casts
This commit is contained in:
@@ -608,7 +608,7 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Error *err)
|
|||||||
FOR_ALL_AUEVENTS(event) {
|
FOR_ALL_AUEVENTS(event) {
|
||||||
FOREACH_ITEM(patterns, pat_object, {
|
FOREACH_ITEM(patterns, pat_object, {
|
||||||
char *pat = pat_object.data.string.data;
|
char *pat = pat_object.data.string.data;
|
||||||
if (!clear_autocmd(event, (char *)pat, au_group, err)) {
|
if (!clear_autocmd(event, pat, au_group, err)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -619,7 +619,7 @@ void nvim_clear_autocmds(Dict(clear_autocmds) *opts, Error *err)
|
|||||||
|
|
||||||
FOREACH_ITEM(patterns, pat_object, {
|
FOREACH_ITEM(patterns, pat_object, {
|
||||||
char *pat = pat_object.data.string.data;
|
char *pat = pat_object.data.string.data;
|
||||||
if (!clear_autocmd(event_nr, (char *)pat, au_group, err)) {
|
if (!clear_autocmd(event_nr, pat, au_group, err)) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -2231,7 +2231,7 @@ int buflist_findpat(const char *pattern, const char *pattern_end, bool unlisted,
|
|||||||
// Repeat this for finding an unlisted buffer if there was no matching
|
// Repeat this for finding an unlisted buffer if there was no matching
|
||||||
// listed buffer.
|
// listed buffer.
|
||||||
|
|
||||||
pat = file_pat_to_reg_pat((char *)pattern, (char *)pattern_end, NULL, false);
|
pat = file_pat_to_reg_pat(pattern, pattern_end, NULL, false);
|
||||||
if (pat == NULL) {
|
if (pat == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -622,7 +622,7 @@ void ex_history(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
histype1 = get_histtype(arg, (size_t)(end - arg), false);
|
histype1 = get_histtype(arg, (size_t)(end - arg), false);
|
||||||
if (histype1 == HIST_INVALID) {
|
if (histype1 == HIST_INVALID) {
|
||||||
if (STRNICMP(arg, "all", end - (char *)arg) == 0) {
|
if (STRNICMP(arg, "all", end - arg) == 0) {
|
||||||
histype1 = 0;
|
histype1 = 0;
|
||||||
histype2 = HIST_COUNT - 1;
|
histype2 = HIST_COUNT - 1;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -984,7 +984,7 @@ void prepare_vimvar(int idx, typval_T *save_tv)
|
|||||||
{
|
{
|
||||||
*save_tv = vimvars[idx].vv_tv;
|
*save_tv = vimvars[idx].vv_tv;
|
||||||
if (vimvars[idx].vv_type == VAR_UNKNOWN) {
|
if (vimvars[idx].vv_type == VAR_UNKNOWN) {
|
||||||
hash_add(&vimvarht, (char *)vimvars[idx].vv_di.di_key);
|
hash_add(&vimvarht, vimvars[idx].vv_di.di_key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -997,7 +997,7 @@ void restore_vimvar(int idx, typval_T *save_tv)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hashitem_T *hi = hash_find(&vimvarht, (char *)vimvars[idx].vv_di.di_key);
|
hashitem_T *hi = hash_find(&vimvarht, vimvars[idx].vv_di.di_key);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
internal_error("restore_vimvar()");
|
internal_error("restore_vimvar()");
|
||||||
} else {
|
} else {
|
||||||
@@ -1145,7 +1145,7 @@ void *call_func_retlist(const char *func, int argc, typval_T *argv)
|
|||||||
typval_T rettv;
|
typval_T rettv;
|
||||||
|
|
||||||
// All arguments are passed as strings, no conversion to number.
|
// All arguments are passed as strings, no conversion to number.
|
||||||
if (call_vim_function((char *)func, argc, argv, &rettv) == FAIL) {
|
if (call_vim_function(func, argc, argv, &rettv) == FAIL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1763,7 +1763,7 @@ notify:
|
|||||||
} else {
|
} else {
|
||||||
dictitem_T *di_ = lp->ll_di;
|
dictitem_T *di_ = lp->ll_di;
|
||||||
assert(di_->di_key != NULL);
|
assert(di_->di_key != NULL);
|
||||||
tv_dict_watcher_notify(dict, (char *)di_->di_key, lp->ll_tv, &oldtv);
|
tv_dict_watcher_notify(dict, di_->di_key, lp->ll_tv, &oldtv);
|
||||||
tv_clear(&oldtv);
|
tv_clear(&oldtv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1785,7 +1785,7 @@ void *eval_for_line(const char *arg, bool *errp, char **nextcmdp, int skip)
|
|||||||
|
|
||||||
*errp = true; // Default: there is an error.
|
*errp = true; // Default: there is an error.
|
||||||
|
|
||||||
expr = skip_var_list((char *)arg, &fi->fi_varcount, &fi->fi_semicolon);
|
expr = skip_var_list(arg, &fi->fi_varcount, &fi->fi_semicolon);
|
||||||
if (expr == NULL) {
|
if (expr == NULL) {
|
||||||
return fi;
|
return fi;
|
||||||
}
|
}
|
||||||
@@ -4828,7 +4828,7 @@ void filter_map(typval_T *argvars, typval_T *rettv, int map)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
vimvars[VV_KEY].vv_str = xstrdup((char *)di->di_key);
|
vimvars[VV_KEY].vv_str = xstrdup(di->di_key);
|
||||||
int r = filter_map_one(&di->di_tv, expr, map, &rem);
|
int r = filter_map_one(&di->di_tv, expr, map, &rem);
|
||||||
tv_clear(&vimvars[VV_KEY].vv_tv);
|
tv_clear(&vimvars[VV_KEY].vv_tv);
|
||||||
if (r == FAIL || did_emsg) {
|
if (r == FAIL || did_emsg) {
|
||||||
@@ -7631,10 +7631,10 @@ int store_session_globals(FILE *fd)
|
|||||||
TV_DICT_ITER(&globvardict, this_var, {
|
TV_DICT_ITER(&globvardict, this_var, {
|
||||||
if ((this_var->di_tv.v_type == VAR_NUMBER
|
if ((this_var->di_tv.v_type == VAR_NUMBER
|
||||||
|| this_var->di_tv.v_type == VAR_STRING)
|
|| this_var->di_tv.v_type == VAR_STRING)
|
||||||
&& var_flavour((char *)this_var->di_key) == VAR_FLAVOUR_SESSION) {
|
&& var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION) {
|
||||||
// Escape special characters with a backslash. Turn a LF and
|
// Escape special characters with a backslash. Turn a LF and
|
||||||
// CR into \n and \r.
|
// CR into \n and \r.
|
||||||
char *const p = (char *)vim_strsave_escaped(tv_get_string(&this_var->di_tv), "\\\"\n\r");
|
char *const p = vim_strsave_escaped(tv_get_string(&this_var->di_tv), "\\\"\n\r");
|
||||||
for (char *t = p; *t != NUL; t++) {
|
for (char *t = p; *t != NUL; t++) {
|
||||||
if (*t == '\n') {
|
if (*t == '\n') {
|
||||||
*t = 'n';
|
*t = 'n';
|
||||||
@@ -7653,7 +7653,7 @@ int store_session_globals(FILE *fd)
|
|||||||
}
|
}
|
||||||
xfree(p);
|
xfree(p);
|
||||||
} else if (this_var->di_tv.v_type == VAR_FLOAT
|
} else if (this_var->di_tv.v_type == VAR_FLOAT
|
||||||
&& var_flavour((char *)this_var->di_key) == VAR_FLAVOUR_SESSION) {
|
&& var_flavour(this_var->di_key) == VAR_FLAVOUR_SESSION) {
|
||||||
float_T f = this_var->di_tv.vval.v_float;
|
float_T f = this_var->di_tv.vval.v_float;
|
||||||
int sign = ' ';
|
int sign = ' ';
|
||||||
|
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
const size_t len = strlen(expr);
|
const size_t len = strlen(expr);
|
||||||
|
|
||||||
while (*p != NUL) {
|
while (*p != NUL) {
|
||||||
if (mb_strnicmp((char *)p, (char *)expr, len) == 0) {
|
if (mb_strnicmp(p, expr, len) == 0) {
|
||||||
n++;
|
n++;
|
||||||
p += len;
|
p += len;
|
||||||
} else {
|
} else {
|
||||||
@@ -965,7 +965,7 @@ static void f_count(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char *next;
|
char *next;
|
||||||
while ((next = strstr((char *)p, (char *)expr)) != NULL) {
|
while ((next = strstr(p, expr)) != NULL) {
|
||||||
n++;
|
n++;
|
||||||
p = next + strlen(expr);
|
p = next + strlen(expr);
|
||||||
}
|
}
|
||||||
@@ -1064,17 +1064,17 @@ static void f_ctxpush(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
TV_LIST_ITER(argvars[0].vval.v_list, li, {
|
TV_LIST_ITER(argvars[0].vval.v_list, li, {
|
||||||
typval_T *tv_li = TV_LIST_ITEM_TV(li);
|
typval_T *tv_li = TV_LIST_ITEM_TV(li);
|
||||||
if (tv_li->v_type == VAR_STRING) {
|
if (tv_li->v_type == VAR_STRING) {
|
||||||
if (strequal((char *)tv_li->vval.v_string, "regs")) {
|
if (strequal(tv_li->vval.v_string, "regs")) {
|
||||||
types |= kCtxRegs;
|
types |= kCtxRegs;
|
||||||
} else if (strequal((char *)tv_li->vval.v_string, "jumps")) {
|
} else if (strequal(tv_li->vval.v_string, "jumps")) {
|
||||||
types |= kCtxJumps;
|
types |= kCtxJumps;
|
||||||
} else if (strequal((char *)tv_li->vval.v_string, "bufs")) {
|
} else if (strequal(tv_li->vval.v_string, "bufs")) {
|
||||||
types |= kCtxBufs;
|
types |= kCtxBufs;
|
||||||
} else if (strequal((char *)tv_li->vval.v_string, "gvars")) {
|
} else if (strequal(tv_li->vval.v_string, "gvars")) {
|
||||||
types |= kCtxGVars;
|
types |= kCtxGVars;
|
||||||
} else if (strequal((char *)tv_li->vval.v_string, "sfuncs")) {
|
} else if (strequal(tv_li->vval.v_string, "sfuncs")) {
|
||||||
types |= kCtxSFuncs;
|
types |= kCtxSFuncs;
|
||||||
} else if (strequal((char *)tv_li->vval.v_string, "funcs")) {
|
} else if (strequal(tv_li->vval.v_string, "funcs")) {
|
||||||
types |= kCtxFuncs;
|
types |= kCtxFuncs;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4953,7 +4953,7 @@ static void f_msgpackdump(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
char msgbuf[sizeof("msgpackdump() argument, index ") * 4 + NUMBUFLEN];
|
char msgbuf[sizeof("msgpackdump() argument, index ") * 4 + NUMBUFLEN];
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
TV_LIST_ITER(list, li, {
|
TV_LIST_ITER(list, li, {
|
||||||
vim_snprintf(msgbuf, sizeof(msgbuf), (char *)msg, idx);
|
vim_snprintf(msgbuf, sizeof(msgbuf), msg, idx);
|
||||||
idx++;
|
idx++;
|
||||||
if (encode_vim_to_msgpack(packer, TV_LIST_ITEM_TV(li), msgbuf) == FAIL) {
|
if (encode_vim_to_msgpack(packer, TV_LIST_ITEM_TV(li), msgbuf) == FAIL) {
|
||||||
break;
|
break;
|
||||||
@@ -6282,7 +6282,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
argv[0] = *rettv;
|
argv[0] = *rettv;
|
||||||
argv[1] = *TV_LIST_ITEM_TV(li);
|
argv[1] = *TV_LIST_ITEM_TV(li);
|
||||||
rettv->v_type = VAR_UNKNOWN;
|
rettv->v_type = VAR_UNKNOWN;
|
||||||
const int r = call_func((char *)func_name, -1, rettv, 2, argv, &funcexe);
|
const int r = call_func(func_name, -1, rettv, 2, argv, &funcexe);
|
||||||
tv_clear(&argv[0]);
|
tv_clear(&argv[0]);
|
||||||
if (r == FAIL || called_emsg != called_emsg_start) {
|
if (r == FAIL || called_emsg != called_emsg_start) {
|
||||||
break;
|
break;
|
||||||
@@ -6315,7 +6315,7 @@ static void f_reduce(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
argv[0] = *rettv;
|
argv[0] = *rettv;
|
||||||
argv[1].v_type = VAR_NUMBER;
|
argv[1].v_type = VAR_NUMBER;
|
||||||
argv[1].vval.v_number = tv_blob_get(b, i);
|
argv[1].vval.v_number = tv_blob_get(b, i);
|
||||||
if (call_func((char *)func_name, -1, rettv, 2, argv, &funcexe) == FAIL) {
|
if (call_func(func_name, -1, rettv, 2, argv, &funcexe) == FAIL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8584,7 +8584,7 @@ static void f_synIDattr(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
rettv->vval.v_string = (char *)(p == NULL ? p : xstrdup(p));
|
rettv->vval.v_string = p == NULL ? NULL : xstrdup(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// "synIDtrans(id)" function
|
/// "synIDtrans(id)" function
|
||||||
|
|||||||
@@ -897,7 +897,7 @@ void f_list2str(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
char buf[MB_MAXBYTES + 1];
|
char buf[MB_MAXBYTES + 1];
|
||||||
|
|
||||||
TV_LIST_ITER_CONST(l, li, {
|
TV_LIST_ITER_CONST(l, li, {
|
||||||
buf[utf_char2bytes((int)tv_get_number(TV_LIST_ITEM_TV(li)), (char *)buf)] = NUL;
|
buf[utf_char2bytes((int)tv_get_number(TV_LIST_ITEM_TV(li)), buf)] = NUL;
|
||||||
ga_concat(&ga, buf);
|
ga_concat(&ga, buf);
|
||||||
});
|
});
|
||||||
ga_append(&ga, NUL);
|
ga_append(&ga, NUL);
|
||||||
@@ -1906,7 +1906,7 @@ dictitem_T *tv_dict_item_copy(dictitem_T *const di)
|
|||||||
void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
|
void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
hashitem_T *const hi = hash_find(&dict->dv_hashtab, (char *)item->di_key);
|
hashitem_T *const hi = hash_find(&dict->dv_hashtab, item->di_key);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
semsg(_(e_intern2), "tv_dict_item_remove()");
|
semsg(_(e_intern2), "tv_dict_item_remove()");
|
||||||
} else {
|
} else {
|
||||||
@@ -2111,9 +2111,9 @@ char **tv_dict_to_env(dict_T *denv)
|
|||||||
TV_DICT_ITER(denv, var, {
|
TV_DICT_ITER(denv, var, {
|
||||||
const char *str = tv_get_string(&var->di_tv);
|
const char *str = tv_get_string(&var->di_tv);
|
||||||
assert(str);
|
assert(str);
|
||||||
size_t len = strlen((char *)var->di_key) + strlen(str) + strlen("=") + 1;
|
size_t len = strlen(var->di_key) + strlen(str) + strlen("=") + 1;
|
||||||
env[i] = xmalloc(len);
|
env[i] = xmalloc(len);
|
||||||
snprintf(env[i], len, "%s=%s", (char *)var->di_key, str);
|
snprintf(env[i], len, "%s=%s", var->di_key, str);
|
||||||
i++;
|
i++;
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -2243,7 +2243,7 @@ int tv_dict_add(dict_T *const d, dictitem_T *const item)
|
|||||||
if (tv_dict_wrong_func_name(d, &item->di_tv, item->di_key)) {
|
if (tv_dict_wrong_func_name(d, &item->di_tv, item->di_key)) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
return hash_add(&d->dv_hashtab, (char *)item->di_key);
|
return hash_add(&d->dv_hashtab, item->di_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Add a list entry to dictionary
|
/// Add a list entry to dictionary
|
||||||
@@ -2944,7 +2944,7 @@ static void tv_dict_list(typval_T *const tv, typval_T *const rettv, const DictLi
|
|||||||
switch (what) {
|
switch (what) {
|
||||||
case kDictListKeys:
|
case kDictListKeys:
|
||||||
tv_item.v_type = VAR_STRING;
|
tv_item.v_type = VAR_STRING;
|
||||||
tv_item.vval.v_string = xstrdup((char *)di->di_key);
|
tv_item.vval.v_string = xstrdup(di->di_key);
|
||||||
break;
|
break;
|
||||||
case kDictListValues:
|
case kDictListValues:
|
||||||
tv_copy(&di->di_tv, &tv_item);
|
tv_copy(&di->di_tv, &tv_item);
|
||||||
|
|||||||
@@ -758,7 +758,7 @@ static void funccal_unref(funccall_T *fc, ufunc_T *fp, bool force)
|
|||||||
/// @return true if the entry was deleted, false if it wasn't found.
|
/// @return true if the entry was deleted, false if it wasn't found.
|
||||||
static bool func_remove(ufunc_T *fp)
|
static bool func_remove(ufunc_T *fp)
|
||||||
{
|
{
|
||||||
hashitem_T *hi = hash_find(&func_hashtab, (char *)UF2HIKEY(fp));
|
hashitem_T *hi = hash_find(&func_hashtab, UF2HIKEY(fp));
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -905,7 +905,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
STRCPY(name, "self");
|
STRCPY(name, "self");
|
||||||
#endif
|
#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, (char *)v->di_key);
|
hash_add(&fc->l_vars.dv_hashtab, v->di_key);
|
||||||
v->di_tv.v_type = VAR_DICT;
|
v->di_tv.v_type = VAR_DICT;
|
||||||
v->di_tv.v_lock = VAR_UNLOCKED;
|
v->di_tv.v_lock = VAR_UNLOCKED;
|
||||||
v->di_tv.vval.v_dict = selfdict;
|
v->di_tv.vval.v_dict = selfdict;
|
||||||
@@ -931,7 +931,7 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
STRCPY(name, "000");
|
STRCPY(name, "000");
|
||||||
#endif
|
#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, (char *)v->di_key);
|
hash_add(&fc->l_avars.dv_hashtab, v->di_key);
|
||||||
v->di_tv.v_type = VAR_LIST;
|
v->di_tv.v_type = VAR_LIST;
|
||||||
v->di_tv.v_lock = VAR_FIXED;
|
v->di_tv.v_lock = VAR_FIXED;
|
||||||
v->di_tv.vval.v_list = &fc->l_varlist;
|
v->di_tv.vval.v_list = &fc->l_varlist;
|
||||||
@@ -1009,9 +1009,9 @@ void call_user_func(ufunc_T *fp, int argcount, typval_T *argvars, typval_T *rett
|
|||||||
// Named arguments can be accessed without the "a:" prefix in lambda
|
// Named arguments can be accessed without the "a:" prefix in lambda
|
||||||
// expressions. Add to the l: dict.
|
// expressions. Add to the l: dict.
|
||||||
tv_copy(&v->di_tv, &v->di_tv);
|
tv_copy(&v->di_tv, &v->di_tv);
|
||||||
hash_add(&fc->l_vars.dv_hashtab, (char *)v->di_key);
|
hash_add(&fc->l_vars.dv_hashtab, v->di_key);
|
||||||
} else {
|
} else {
|
||||||
hash_add(&fc->l_avars.dv_hashtab, (char *)v->di_key);
|
hash_add(&fc->l_avars.dv_hashtab, v->di_key);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ai >= 0 && ai < MAX_FUNC_ARGS) {
|
if (ai >= 0 && ai < MAX_FUNC_ARGS) {
|
||||||
@@ -1770,7 +1770,7 @@ char *trans_function_name(char **pp, bool skip, int flags, funcdict_T *fdp, part
|
|||||||
semsg(_(e_invarg2), start);
|
semsg(_(e_invarg2), start);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
*pp = (char *)find_name_end((char *)start, NULL, NULL, FNE_INCL_BR);
|
*pp = (char *)find_name_end(start, NULL, NULL, FNE_INCL_BR);
|
||||||
}
|
}
|
||||||
goto theend;
|
goto theend;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -406,7 +406,7 @@ static const char *skip_var_one(const char *arg)
|
|||||||
if (*arg == '@' && arg[1] != NUL) {
|
if (*arg == '@' && arg[1] != NUL) {
|
||||||
return arg + 2;
|
return arg + 2;
|
||||||
}
|
}
|
||||||
return (char *)find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
|
return find_name_end(*arg == '$' || *arg == '&' ? arg + 1 : arg,
|
||||||
NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
|
NULL, NULL, FNE_INCL_BR | FNE_CHECK_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ static int get_winnr(tabpage_T *tp, typval_T *argvar)
|
|||||||
} else {
|
} else {
|
||||||
// Extract the window count (if specified). e.g. winnr('3j')
|
// Extract the window count (if specified). e.g. winnr('3j')
|
||||||
char *endp;
|
char *endp;
|
||||||
long count = strtol((char *)arg, &endp, 10);
|
long count = strtol(arg, &endp, 10);
|
||||||
if (count <= 0) {
|
if (count <= 0) {
|
||||||
// if count is not specified, default to 1
|
// if count is not specified, default to 1
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ void do_ascii(const exarg_T *const eap)
|
|||||||
if (vim_isprintc_strict(c) && (c < ' ' || c > '~')) {
|
if (vim_isprintc_strict(c) && (c < ' ' || c > '~')) {
|
||||||
char buf3[7];
|
char buf3[7];
|
||||||
transchar_nonprint(curbuf, buf3, c);
|
transchar_nonprint(curbuf, buf3, c);
|
||||||
vim_snprintf(buf1, sizeof(buf1), " <%s>", (char *)buf3);
|
vim_snprintf(buf1, sizeof(buf1), " <%s>", buf3);
|
||||||
} else {
|
} else {
|
||||||
buf1[0] = NUL;
|
buf1[0] = NUL;
|
||||||
}
|
}
|
||||||
@@ -1361,12 +1361,12 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
|
|||||||
{
|
{
|
||||||
bool is_fish_shell =
|
bool is_fish_shell =
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
strncmp((char *)invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
|
strncmp(invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
|
||||||
#else
|
#else
|
||||||
false;
|
false;
|
||||||
#endif
|
#endif
|
||||||
bool is_pwsh = strncmp((char *)invocation_path_tail(p_sh, NULL), "pwsh", 4) == 0
|
bool is_pwsh = strncmp(invocation_path_tail(p_sh, NULL), "pwsh", 4) == 0
|
||||||
|| strncmp((char *)invocation_path_tail(p_sh, NULL), "powershell",
|
|| strncmp(invocation_path_tail(p_sh, NULL), "powershell",
|
||||||
10) == 0;
|
10) == 0;
|
||||||
|
|
||||||
size_t len = strlen(cmd) + 1; // At least enough space for cmd + NULL.
|
size_t len = strlen(cmd) + 1; // At least enough space for cmd + NULL.
|
||||||
@@ -4288,7 +4288,7 @@ bool do_sub_msg(bool count_only)
|
|||||||
"%" PRId64 " matches on %" PRId64 " lines", sub_nsubs)
|
"%" PRId64 " matches on %" PRId64 " lines", sub_nsubs)
|
||||||
: NGETTEXT("%" PRId64 " substitution on %" PRId64 " lines",
|
: NGETTEXT("%" PRId64 " substitution on %" PRId64 " lines",
|
||||||
"%" PRId64 " substitutions on %" PRId64 " lines", sub_nsubs);
|
"%" PRId64 " substitutions on %" PRId64 " lines", sub_nsubs);
|
||||||
vim_snprintf_add((char *)msg_buf, sizeof(msg_buf),
|
vim_snprintf_add(msg_buf, sizeof(msg_buf),
|
||||||
NGETTEXT(msg_single, msg_plural, sub_nlines),
|
NGETTEXT(msg_single, msg_plural, sub_nlines),
|
||||||
(int64_t)sub_nsubs, (int64_t)sub_nlines);
|
(int64_t)sub_nsubs, (int64_t)sub_nlines);
|
||||||
if (msg(msg_buf)) {
|
if (msg(msg_buf)) {
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ static bool do_incsearch_highlighting(int firstc, int *search_delim, incsearch_s
|
|||||||
if (*p == '!') {
|
if (*p == '!') {
|
||||||
p = skipwhite(p + 1);
|
p = skipwhite(p + 1);
|
||||||
}
|
}
|
||||||
while (ASCII_ISALPHA(*(p = skipwhite((char *)p)))) {
|
while (ASCII_ISALPHA(*(p = skipwhite(p)))) {
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
|
|||||||
@@ -2007,8 +2007,8 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|
|||||||
// Don't allow mapping the first byte(s) of a multi-byte char.
|
// Don't allow mapping the first byte(s) of a multi-byte char.
|
||||||
// Happens when mapping <M-a> and then changing 'encoding'.
|
// Happens when mapping <M-a> and then changing 'encoding'.
|
||||||
// Beware that 0x80 is escaped.
|
// Beware that 0x80 is escaped.
|
||||||
char *p1 = mp->m_keys;
|
const char *p1 = mp->m_keys;
|
||||||
char *p2 = (char *)mb_unescape((const char **)&p1);
|
const char *p2 = mb_unescape(&p1);
|
||||||
|
|
||||||
if (p2 != NULL && MB_BYTE2LEN(tb_c1) > utfc_ptr2len(p2)) {
|
if (p2 != NULL && MB_BYTE2LEN(tb_c1) > utfc_ptr2len(p2)) {
|
||||||
mlen = 0;
|
mlen = 0;
|
||||||
|
|||||||
@@ -1154,7 +1154,7 @@ static void do_helptags(char *dirname, bool add_help_tags, bool ignore_writeerr)
|
|||||||
ext[1] = fname[5];
|
ext[1] = fname[5];
|
||||||
ext[2] = fname[6];
|
ext[2] = fname[6];
|
||||||
}
|
}
|
||||||
helptags_one(dirname, (char *)ext, (char *)fname, add_help_tags, ignore_writeerr);
|
helptags_one(dirname, ext, fname, add_help_tags, ignore_writeerr);
|
||||||
}
|
}
|
||||||
|
|
||||||
ga_clear(&ga);
|
ga_clear(&ga);
|
||||||
|
|||||||
@@ -1002,7 +1002,7 @@ char *replace_termcodes(const char *const from, const size_t from_len, char **co
|
|||||||
}
|
}
|
||||||
|
|
||||||
// skip multibyte char correctly
|
// skip multibyte char correctly
|
||||||
for (i = utfc_ptr2len_len((char *)src, (int)(end - src) + 1); i > 0; i--) {
|
for (i = utfc_ptr2len_len(src, (int)(end - src) + 1); i > 0; i--) {
|
||||||
// If the character is K_SPECIAL, replace it with K_SPECIAL
|
// If the character is K_SPECIAL, replace it with K_SPECIAL
|
||||||
// KS_SPECIAL KE_FILLER.
|
// KS_SPECIAL KE_FILLER.
|
||||||
if (*src == (char)K_SPECIAL) {
|
if (*src == (char)K_SPECIAL) {
|
||||||
|
|||||||
@@ -1172,7 +1172,7 @@ int nlua_call(lua_State *lstate)
|
|||||||
TRY_WRAP(&err, {
|
TRY_WRAP(&err, {
|
||||||
// call_func() retval is deceptive, ignore it. Instead we set `msg_list`
|
// call_func() retval is deceptive, ignore it. Instead we set `msg_list`
|
||||||
// (TRY_WRAP) to capture abort-causing non-exception errors.
|
// (TRY_WRAP) to capture abort-causing non-exception errors.
|
||||||
(void)call_func((char *)name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
|
(void)call_func(name, (int)name_len, &rettv, nargs, vim_args, &funcexe);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!ERROR_SET(&err)) {
|
if (!ERROR_SET(&err)) {
|
||||||
|
|||||||
@@ -422,7 +422,7 @@ static int str_to_mapargs(const char *strargs, bool is_unmap, MapArguments *mapa
|
|||||||
|
|
||||||
// {lhs_end} is a pointer to the "terminating whitespace" after {lhs}.
|
// {lhs_end} is a pointer to the "terminating whitespace" after {lhs}.
|
||||||
// Use that to initialize {rhs_start}.
|
// Use that to initialize {rhs_start}.
|
||||||
const char *rhs_start = skipwhite((char *)lhs_end);
|
const char *rhs_start = skipwhite(lhs_end);
|
||||||
|
|
||||||
// Given {lhs} might be larger than MAXMAPLEN before replace_termcodes
|
// Given {lhs} might be larger than MAXMAPLEN before replace_termcodes
|
||||||
// (e.g. "<Space>" is longer than ' '), so first copy into a buffer.
|
// (e.g. "<Space>" is longer than ' '), so first copy into a buffer.
|
||||||
@@ -594,7 +594,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
|
|||||||
|
|
||||||
const int first = vim_iswordp(lhs);
|
const int first = vim_iswordp(lhs);
|
||||||
int last = first;
|
int last = first;
|
||||||
p = (char *)lhs + utfc_ptr2len((char *)lhs);
|
p = lhs + utfc_ptr2len(lhs);
|
||||||
n = 1;
|
n = 1;
|
||||||
while (p < lhs + len) {
|
while (p < lhs + len) {
|
||||||
n++; // nr of (multi-byte) chars
|
n++; // nr of (multi-byte) chars
|
||||||
@@ -733,8 +733,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
|
|||||||
// we ignore trailing space when matching with
|
// we ignore trailing space when matching with
|
||||||
// the "lhs", since an abbreviation can't have
|
// the "lhs", since an abbreviation can't have
|
||||||
// trailing space.
|
// trailing space.
|
||||||
if (n != len && (!is_abbrev || round || n > len
|
if (n != len && (!is_abbrev || round || n > len || *skipwhite(lhs + n) != NUL)) {
|
||||||
|| *skipwhite((char *)lhs + n) != NUL)) {
|
|
||||||
mpp = &(mp->m_next);
|
mpp = &(mp->m_next);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -857,7 +856,7 @@ static int buf_do_map(int maptype, MapArguments *args, int mode, bool is_abbrev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get here when adding a new entry to the maphash[] list or abbrlist.
|
// Get here when adding a new entry to the maphash[] list or abbrlist.
|
||||||
map_add(buf, map_table, abbr_table, (char *)lhs, args, noremap, mode, is_abbrev,
|
map_add(buf, map_table, abbr_table, lhs, args, noremap, mode, is_abbrev,
|
||||||
-1, // sid
|
-1, // sid
|
||||||
0, // lnum
|
0, // lnum
|
||||||
keyround1_simplified);
|
keyround1_simplified);
|
||||||
@@ -2645,10 +2644,10 @@ void modify_keymap(uint64_t channel_id, Buffer buffer, bool is_unmap, String mod
|
|||||||
case 0:
|
case 0:
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
api_set_error(err, kErrorTypeException, (char *)e_invarg, 0);
|
api_set_error(err, kErrorTypeException, e_invarg, 0);
|
||||||
goto fail_and_free;
|
goto fail_and_free;
|
||||||
case 2:
|
case 2:
|
||||||
api_set_error(err, kErrorTypeException, (char *)e_nomap, 0);
|
api_set_error(err, kErrorTypeException, e_nomap, 0);
|
||||||
goto fail_and_free;
|
goto fail_and_free;
|
||||||
case 5:
|
case 5:
|
||||||
api_set_error(err, kErrorTypeException,
|
api_set_error(err, kErrorTypeException,
|
||||||
|
|||||||
@@ -1216,7 +1216,7 @@ void mt_inspect_node(MarkTree *b, garray_T *ga, mtnode_t *n, mtpos_t off)
|
|||||||
for (int i = 0; i < n->n; i++) {
|
for (int i = 0; i < n->n; i++) {
|
||||||
mtpos_t p = n->key[i].pos;
|
mtpos_t p = n->key[i].pos;
|
||||||
unrelative(off, &p);
|
unrelative(off, &p);
|
||||||
snprintf((char *)buf, sizeof(buf), "%d/%d", p.row, p.col);
|
snprintf(buf, sizeof(buf), "%d/%d", p.row, p.col);
|
||||||
ga_concat(ga, buf);
|
ga_concat(ga, buf);
|
||||||
if (n->level) {
|
if (n->level) {
|
||||||
mt_inspect_node(b, ga, n->ptr[i + 1], p);
|
mt_inspect_node(b, ga, n->ptr[i + 1], p);
|
||||||
|
|||||||
@@ -726,7 +726,7 @@ bool utf_composinglike(const char *p1, const char *p2)
|
|||||||
if (!arabic_maycombine(c2)) {
|
if (!arabic_maycombine(c2)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return arabic_combine(utf_ptr2char((char *)p1), c2);
|
return arabic_combine(utf_ptr2char(p1), c2);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert a UTF-8 string to a wide character
|
/// Convert a UTF-8 string to a wide character
|
||||||
@@ -1312,10 +1312,10 @@ static int utf_strnicmp(const char *s1, const char *s2, size_t n1, size_t n2)
|
|||||||
// to fold just one character to determine the result of comparison.
|
// to fold just one character to determine the result of comparison.
|
||||||
|
|
||||||
if (c1 != -1 && c2 == -1) {
|
if (c1 != -1 && c2 == -1) {
|
||||||
n1 = (size_t)utf_char2bytes(utf_fold(c1), (char *)buffer);
|
n1 = (size_t)utf_char2bytes(utf_fold(c1), buffer);
|
||||||
s1 = buffer;
|
s1 = buffer;
|
||||||
} else if (c2 != -1 && c1 == -1) {
|
} else if (c2 != -1 && c1 == -1) {
|
||||||
n2 = (size_t)utf_char2bytes(utf_fold(c2), (char *)buffer);
|
n2 = (size_t)utf_char2bytes(utf_fold(c2), buffer);
|
||||||
s2 = buffer;
|
s2 = buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -800,7 +800,7 @@ static bool mf_do_open(memfile_T *mfp, char *fname, int flags)
|
|||||||
emsg(_("E300: Swap file already exists (symlink attack?)"));
|
emsg(_("E300: Swap file already exists (symlink attack?)"));
|
||||||
} else {
|
} else {
|
||||||
// try to open the file
|
// try to open the file
|
||||||
mfp->mf_fd = MCH_OPEN_RW((char *)mfp->mf_fname, flags | O_NOFOLLOW);
|
mfp->mf_fd = MCH_OPEN_RW(mfp->mf_fname, flags | O_NOFOLLOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the file cannot be opened, use memory only
|
// If the file cannot be opened, use memory only
|
||||||
|
|||||||
@@ -5676,7 +5676,7 @@ static Dictionary vimoption2dict(vimoption_T *opt, int req_scope, buf_T *buf, wi
|
|||||||
char *def_val = opt->def_val;
|
char *def_val = opt->def_val;
|
||||||
if (opt->flags & P_STRING) {
|
if (opt->flags & P_STRING) {
|
||||||
type = "string";
|
type = "string";
|
||||||
def = CSTR_TO_OBJ(def_val ? (char *)def_val : "");
|
def = CSTR_TO_OBJ(def_val ? def_val : "");
|
||||||
} else if (opt->flags & P_NUM) {
|
} else if (opt->flags & P_NUM) {
|
||||||
type = "number";
|
type = "number";
|
||||||
def = INTEGER_OBJ((Integer)(intptr_t)def_val);
|
def = INTEGER_OBJ((Integer)(intptr_t)def_val);
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
|
|||||||
|
|
||||||
bool is_fish_shell =
|
bool is_fish_shell =
|
||||||
#if defined(UNIX)
|
#if defined(UNIX)
|
||||||
strncmp((char *)invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
|
strncmp(invocation_path_tail(p_sh, NULL), "fish", 4) == 0;
|
||||||
#else
|
#else
|
||||||
false;
|
false;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -641,7 +641,7 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
|
|||||||
while (*path_end != NUL) {
|
while (*path_end != NUL) {
|
||||||
// May ignore a wildcard that has a backslash before it; it will
|
// May ignore a wildcard that has a backslash before it; it will
|
||||||
// be removed by rem_backslash() or file_pat_to_reg_pat() below.
|
// be removed by rem_backslash() or file_pat_to_reg_pat() below.
|
||||||
if (path_end >= path + wildoff && rem_backslash((char *)path_end)) {
|
if (path_end >= path + wildoff && rem_backslash(path_end)) {
|
||||||
*p++ = *path_end++;
|
*p++ = *path_end++;
|
||||||
} else if (vim_ispathsep_nocolon(*path_end)) {
|
} else if (vim_ispathsep_nocolon(*path_end)) {
|
||||||
if (e != NULL) {
|
if (e != NULL) {
|
||||||
@@ -651,7 +651,7 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
|
|||||||
} else if (path_end >= path + wildoff
|
} else if (path_end >= path + wildoff
|
||||||
&& (vim_strchr("*?[{~$", (uint8_t)(*path_end)) != NULL
|
&& (vim_strchr("*?[{~$", (uint8_t)(*path_end)) != NULL
|
||||||
#ifndef MSWIN
|
#ifndef MSWIN
|
||||||
|| (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char((char *)path_end)))
|
|| (!p_fic && (flags & EW_ICASE) && mb_isalpha(utf_ptr2char(path_end)))
|
||||||
#endif
|
#endif
|
||||||
)) { // NOLINT(whitespace/parens)
|
)) { // NOLINT(whitespace/parens)
|
||||||
e = p;
|
e = p;
|
||||||
@@ -727,9 +727,9 @@ static size_t do_path_expand(garray_T *gap, const char *path, size_t wildoff, in
|
|||||||
char *dirpath = (*buf == NUL ? "." : buf);
|
char *dirpath = (*buf == NUL ? "." : buf);
|
||||||
if (os_file_is_readable(dirpath) && os_scandir(&dir, dirpath)) {
|
if (os_file_is_readable(dirpath) && os_scandir(&dir, dirpath)) {
|
||||||
// Find all matching entries.
|
// Find all matching entries.
|
||||||
char *name;
|
const char *name;
|
||||||
scandir_next_with_dots(NULL); // initialize
|
scandir_next_with_dots(NULL); // initialize
|
||||||
while (!got_int && (name = (char *)scandir_next_with_dots(&dir)) != NULL) {
|
while (!got_int && (name = scandir_next_with_dots(&dir)) != NULL) {
|
||||||
if ((name[0] != '.'
|
if ((name[0] != '.'
|
||||||
|| starts_with_dot
|
|| starts_with_dot
|
||||||
|| ((flags & EW_DODOT)
|
|| ((flags & EW_DODOT)
|
||||||
|
|||||||
@@ -531,7 +531,7 @@ static int efm_to_regpat(const char *efm, int len, efm_T *fmt_ptr, char *regpat)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (idx < FMT_PATTERNS) {
|
if (idx < FMT_PATTERNS) {
|
||||||
ptr = efmpat_to_regpat((char *)efmp, ptr, fmt_ptr, idx, round);
|
ptr = efmpat_to_regpat(efmp, ptr, fmt_ptr, idx, round);
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
@@ -1241,7 +1241,7 @@ static char *qf_cmdtitle(char *cmd)
|
|||||||
{
|
{
|
||||||
static char qftitle_str[IOSIZE];
|
static char qftitle_str[IOSIZE];
|
||||||
|
|
||||||
snprintf((char *)qftitle_str, IOSIZE, ":%s", cmd);
|
snprintf(qftitle_str, IOSIZE, ":%s", cmd);
|
||||||
|
|
||||||
return qftitle_str;
|
return qftitle_str;
|
||||||
}
|
}
|
||||||
@@ -3281,7 +3281,7 @@ static void qf_msg(qf_info_T *qi, int which, char *lead)
|
|||||||
int count = qi->qf_lists[which].qf_count;
|
int count = qi->qf_lists[which].qf_count;
|
||||||
char buf[IOSIZE];
|
char buf[IOSIZE];
|
||||||
|
|
||||||
vim_snprintf((char *)buf, IOSIZE, _("%serror list %d of %d; %d errors "),
|
vim_snprintf(buf, IOSIZE, _("%serror list %d of %d; %d errors "),
|
||||||
lead,
|
lead,
|
||||||
which + 1,
|
which + 1,
|
||||||
qi->qf_listcount,
|
qi->qf_listcount,
|
||||||
@@ -3506,7 +3506,7 @@ static char *qf_types(int c, int nr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static char buf[20];
|
static char buf[20];
|
||||||
snprintf((char *)buf, sizeof(buf), "%s %3d", p, nr);
|
snprintf(buf, sizeof(buf), "%s %3d", p, nr);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1039,7 +1039,7 @@ static int load_pack_plugin(bool opt, char *fname)
|
|||||||
do_cmdline_cmd("augroup filetypedetect");
|
do_cmdline_cmd("augroup filetypedetect");
|
||||||
vim_snprintf(pat, len, ftpat, ffname);
|
vim_snprintf(pat, len, ftpat, ffname);
|
||||||
source_all_matches(pat);
|
source_all_matches(pat);
|
||||||
vim_snprintf((char *)pat, len, "%s/ftdetect/*.lua", ffname); // NOLINT
|
vim_snprintf(pat, len, "%s/ftdetect/*.lua", ffname); // NOLINT
|
||||||
source_all_matches(pat);
|
source_all_matches(pat);
|
||||||
do_cmdline_cmd("augroup END");
|
do_cmdline_cmd("augroup END");
|
||||||
}
|
}
|
||||||
@@ -1784,7 +1784,7 @@ static bool concat_continued_line(garray_T *const ga, const int init_growsize, c
|
|||||||
size_t len)
|
size_t len)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
const char *const line = skipwhite_len((char *)p, len);
|
const char *const line = skipwhite_len(p, len);
|
||||||
len -= (size_t)(line - p);
|
len -= (size_t)(line - p);
|
||||||
// Skip lines starting with '\" ', concat lines starting with '\'
|
// Skip lines starting with '\" ', concat lines starting with '\'
|
||||||
if (len >= 3 && strncmp(line, "\"\\ ", 3) == 0) {
|
if (len >= 3 && strncmp(line, "\"\\ ", 3) == 0) {
|
||||||
@@ -1878,7 +1878,7 @@ static int source_using_linegetter(void *cookie, LineGetter fgetline, const char
|
|||||||
if (save_sourcing_name == NULL) {
|
if (save_sourcing_name == NULL) {
|
||||||
sname = (char *)traceback_name;
|
sname = (char *)traceback_name;
|
||||||
} else {
|
} else {
|
||||||
snprintf((char *)sourcing_name_buf, sizeof(sourcing_name_buf),
|
snprintf(sourcing_name_buf, sizeof(sourcing_name_buf),
|
||||||
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
|
"%s called at %s:%" PRIdLINENR, traceback_name, save_sourcing_name,
|
||||||
save_sourcing_lnum);
|
save_sourcing_lnum);
|
||||||
sname = sourcing_name_buf;
|
sname = sourcing_name_buf;
|
||||||
|
|||||||
@@ -2233,10 +2233,10 @@ int check_linecomment(const char *line)
|
|||||||
const char *p = line; // scan from start
|
const char *p = line; // scan from start
|
||||||
// skip Lispish one-line comments
|
// skip Lispish one-line comments
|
||||||
if (curbuf->b_p_lisp) {
|
if (curbuf->b_p_lisp) {
|
||||||
if (vim_strchr((char *)p, ';') != NULL) { // there may be comments
|
if (vim_strchr(p, ';') != NULL) { // there may be comments
|
||||||
bool in_str = false; // inside of string
|
bool in_str = false; // inside of string
|
||||||
|
|
||||||
while ((p = strpbrk((char *)p, "\";")) != NULL) {
|
while ((p = strpbrk(p, "\";")) != NULL) {
|
||||||
if (*p == '"') {
|
if (*p == '"') {
|
||||||
if (in_str) {
|
if (in_str) {
|
||||||
if (*(p - 1) != '\\') { // skip escaped quote
|
if (*(p - 1) != '\\') { // skip escaped quote
|
||||||
@@ -2258,7 +2258,7 @@ int check_linecomment(const char *line)
|
|||||||
p = NULL;
|
p = NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
while ((p = vim_strchr((char *)p, '/')) != NULL) {
|
while ((p = vim_strchr(p, '/')) != NULL) {
|
||||||
// Accept a double /, unless it's preceded with * and followed by *,
|
// Accept a double /, unless it's preceded with * and followed by *,
|
||||||
// because * / / * is an end and start of a C comment. Only
|
// because * / / * is an end and start of a C comment. Only
|
||||||
// accept the position if it is not inside a string.
|
// accept the position if it is not inside a string.
|
||||||
@@ -3055,7 +3055,7 @@ static int fuzzy_match_recursive(const char *fuzpat, const char *str, uint32_t s
|
|||||||
// Recursive call that "skips" this match
|
// Recursive call that "skips" this match
|
||||||
uint32_t recursiveMatches[MAX_FUZZY_MATCHES];
|
uint32_t recursiveMatches[MAX_FUZZY_MATCHES];
|
||||||
int recursiveScore = 0;
|
int recursiveScore = 0;
|
||||||
const char *const next_char = (char *)str + utfc_ptr2len((char *)str);
|
const char *const next_char = str + utfc_ptr2len(str);
|
||||||
if (fuzzy_match_recursive(fuzpat, next_char, strIdx + 1, &recursiveScore, strBegin, strLen,
|
if (fuzzy_match_recursive(fuzpat, next_char, strIdx + 1, &recursiveScore, strBegin, strLen,
|
||||||
matches, recursiveMatches,
|
matches, recursiveMatches,
|
||||||
sizeof(recursiveMatches) / sizeof(recursiveMatches[0]), nextMatch,
|
sizeof(recursiveMatches) / sizeof(recursiveMatches[0]), nextMatch,
|
||||||
@@ -4015,7 +4015,7 @@ search_line:
|
|||||||
curwin->w_cursor.lnum = lnum;
|
curwin->w_cursor.lnum = lnum;
|
||||||
check_cursor();
|
check_cursor();
|
||||||
} else {
|
} else {
|
||||||
if (!GETFILE_SUCCESS(getfile(0, (char *)files[depth].name, NULL, true,
|
if (!GETFILE_SUCCESS(getfile(0, files[depth].name, NULL, true,
|
||||||
files[depth].lnum, false))) {
|
files[depth].lnum, false))) {
|
||||||
break; // failed to jump to file
|
break; // failed to jump to file
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4009,7 +4009,7 @@ static bool shada_removable(const char *name)
|
|||||||
char part[MAXPATHL + 1];
|
char part[MAXPATHL + 1];
|
||||||
bool retval = false;
|
bool retval = false;
|
||||||
|
|
||||||
char *new_name = home_replace_save(NULL, (char *)name);
|
char *new_name = home_replace_save(NULL, name);
|
||||||
for (p = p_shada; *p;) {
|
for (p = p_shada; *p;) {
|
||||||
(void)copy_option_part(&p, part, ARRAY_SIZE(part), ", ");
|
(void)copy_option_part(&p, part, ARRAY_SIZE(part), ", ");
|
||||||
if (part[0] == 'r') {
|
if (part[0] == 'r') {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ static signgroup_T *sign_group_ref(const char *groupname)
|
|||||||
signgroup_T *group;
|
signgroup_T *group;
|
||||||
|
|
||||||
hash = hash_hash(groupname);
|
hash = hash_hash(groupname);
|
||||||
hi = hash_lookup(&sg_table, (char *)groupname, strlen(groupname), hash);
|
hi = hash_lookup(&sg_table, groupname, strlen(groupname), hash);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
// new group
|
// new group
|
||||||
group = xmalloc(offsetof(signgroup_T, sg_name) + strlen(groupname) + 1);
|
group = xmalloc(offsetof(signgroup_T, sg_name) + strlen(groupname) + 1);
|
||||||
@@ -156,7 +156,7 @@ static int sign_group_get_next_signid(buf_T *buf, const char *groupname)
|
|||||||
int found = false;
|
int found = false;
|
||||||
|
|
||||||
if (groupname != NULL) {
|
if (groupname != NULL) {
|
||||||
hashitem_T *hi = hash_find(&sg_table, (char *)groupname);
|
hashitem_T *hi = hash_find(&sg_table, groupname);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
@@ -174,7 +174,7 @@ static int sign_group_get_next_signid(buf_T *buf, const char *groupname)
|
|||||||
// Check whether this sign is already placed in the buffer
|
// Check whether this sign is already placed in the buffer
|
||||||
found = true;
|
found = true;
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
|
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
|
||||||
if (id == sign->se_id && sign_in_group(sign, (char *)groupname)) {
|
if (id == sign->se_id && sign_in_group(sign, groupname)) {
|
||||||
found = false; // sign identifier is in use
|
found = false; // sign identifier is in use
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -442,7 +442,7 @@ static linenr_T buf_change_sign_type(buf_T *buf, int markId, const char *group,
|
|||||||
sign_entry_T *sign; // a sign in the signlist
|
sign_entry_T *sign; // a sign in the signlist
|
||||||
|
|
||||||
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
|
FOR_ALL_SIGNS_IN_BUF(buf, sign) {
|
||||||
if (sign->se_id == markId && sign_in_group(sign, (char *)group)) {
|
if (sign->se_id == markId && sign_in_group(sign, group)) {
|
||||||
sign->se_typenr = typenr;
|
sign->se_typenr = typenr;
|
||||||
sign->se_priority = prio;
|
sign->se_priority = prio;
|
||||||
sign_sort_by_prio_on_line(buf, sign);
|
sign_sort_by_prio_on_line(buf, sign);
|
||||||
@@ -2148,7 +2148,7 @@ static int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *n
|
|||||||
{
|
{
|
||||||
int sign_id = 0;
|
int sign_id = 0;
|
||||||
char *group = NULL;
|
char *group = NULL;
|
||||||
char *sign_name = NULL;
|
const char *sign_name = NULL;
|
||||||
buf_T *buf = NULL;
|
buf_T *buf = NULL;
|
||||||
dictitem_T *di;
|
dictitem_T *di;
|
||||||
linenr_T lnum = 0;
|
linenr_T lnum = 0;
|
||||||
@@ -2207,7 +2207,7 @@ static int sign_place_from_dict(typval_T *id_tv, typval_T *group_tv, typval_T *n
|
|||||||
if (name_tv == NULL) {
|
if (name_tv == NULL) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
sign_name = (char *)tv_get_string_chk(name_tv);
|
sign_name = tv_get_string_chk(name_tv);
|
||||||
if (sign_name == NULL) {
|
if (sign_name == NULL) {
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
@@ -2307,7 +2307,7 @@ static void sign_undefine_multiple(list_T *l, list_T *retlist)
|
|||||||
TV_LIST_ITER_CONST(l, li, {
|
TV_LIST_ITER_CONST(l, li, {
|
||||||
retval = -1;
|
retval = -1;
|
||||||
name = (char *)tv_get_string_chk(TV_LIST_ITEM_TV(li));
|
name = (char *)tv_get_string_chk(TV_LIST_ITEM_TV(li));
|
||||||
if (name != NULL && (sign_undefine_by_name((char *)name) == OK)) {
|
if (name != NULL && (sign_undefine_by_name(name) == OK)) {
|
||||||
retval = 0;
|
retval = 0;
|
||||||
}
|
}
|
||||||
tv_list_append_number(retlist, retval);
|
tv_list_append_number(retlist, retval);
|
||||||
|
|||||||
@@ -1443,8 +1443,8 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
|
|||||||
// Store the current buffer number as a string variable
|
// Store the current buffer number as a string variable
|
||||||
vim_snprintf(buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
|
vim_snprintf(buf_tmp, sizeof(buf_tmp), "%d", curbuf->b_fnum);
|
||||||
set_internal_string_var("g:actual_curbuf", buf_tmp);
|
set_internal_string_var("g:actual_curbuf", buf_tmp);
|
||||||
vim_snprintf((char *)win_tmp, sizeof(win_tmp), "%d", curwin->handle);
|
vim_snprintf(win_tmp, sizeof(win_tmp), "%d", curwin->handle);
|
||||||
set_internal_string_var("g:actual_curwin", (char *)win_tmp);
|
set_internal_string_var("g:actual_curwin", win_tmp);
|
||||||
|
|
||||||
buf_T *const save_curbuf = curbuf;
|
buf_T *const save_curbuf = curbuf;
|
||||||
win_T *const save_curwin = curwin;
|
win_T *const save_curwin = curwin;
|
||||||
|
|||||||
@@ -946,10 +946,10 @@ int vim_vsnprintf_typval(char *str, size_t str_m, const char *fmt, va_list ap, t
|
|||||||
- str_arg);
|
- str_arg);
|
||||||
}
|
}
|
||||||
if (fmt_spec == 'S') {
|
if (fmt_spec == 'S') {
|
||||||
char *p1;
|
const char *p1;
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|
||||||
for (i = 0, p1 = (char *)str_arg; *p1; p1 += utfc_ptr2len(p1)) {
|
for (i = 0, p1 = str_arg; *p1; p1 += utfc_ptr2len(p1)) {
|
||||||
size_t cell = (size_t)utf_ptr2cells(p1);
|
size_t cell = (size_t)utf_ptr2cells(p1);
|
||||||
if (precision_specified && i + cell > precision) {
|
if (precision_specified && i + cell > precision) {
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -3674,7 +3674,7 @@ static void syn_clear_keyword(int id, hashtab_T *ht)
|
|||||||
if (kp_next == NULL) {
|
if (kp_next == NULL) {
|
||||||
hash_remove(ht, hi);
|
hash_remove(ht, hi);
|
||||||
} else {
|
} else {
|
||||||
hi->hi_key = (char *)KE2HIKEY(kp_next);
|
hi->hi_key = KE2HIKEY(kp_next);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
kp_prev->ke_next = kp_next;
|
kp_prev->ke_next = kp_next;
|
||||||
|
|||||||
Reference in New Issue
Block a user