mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor: remove redundant const char * casts
This commit is contained in:
parent
1d2a29f75b
commit
9408f2dcf7
@ -49,7 +49,7 @@ typedef struct {
|
|||||||
#define TYPVAL_ENCODE_CONV_STRING(tv, str, len) \
|
#define TYPVAL_ENCODE_CONV_STRING(tv, str, len) \
|
||||||
do { \
|
do { \
|
||||||
const size_t len_ = (size_t)(len); \
|
const size_t len_ = (size_t)(len); \
|
||||||
const char *const str_ = (const char *)(str); \
|
const char *const str_ = (str); \
|
||||||
assert(len_ == 0 || str_ != NULL); \
|
assert(len_ == 0 || str_ != NULL); \
|
||||||
kvi_push(edata->stack, STRING_OBJ(cbuf_to_string((len_?str_:""), len_))); \
|
kvi_push(edata->stack, STRING_OBJ(cbuf_to_string((len_?str_:""), len_))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -843,7 +843,7 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
|
|||||||
uint32_t csize = (repeat > 1) ? 3 : ((attrs[i] != last_hl) ? 2 : 1);
|
uint32_t csize = (repeat > 1) ? 3 : ((attrs[i] != last_hl) ? 2 : 1);
|
||||||
nelem++;
|
nelem++;
|
||||||
mpack_array(buf, csize);
|
mpack_array(buf, csize);
|
||||||
mpack_str(buf, (const char *)chunk[i]);
|
mpack_str(buf, chunk[i]);
|
||||||
if (csize >= 2) {
|
if (csize >= 2) {
|
||||||
mpack_uint(buf, (uint32_t)attrs[i]);
|
mpack_uint(buf, (uint32_t)attrs[i]);
|
||||||
if (csize >= 3) {
|
if (csize >= 3) {
|
||||||
@ -873,7 +873,7 @@ void remote_ui_raw_line(UI *ui, Integer grid, Integer row, Integer startcol, Int
|
|||||||
for (int i = 0; i < endcol - startcol; i++) {
|
for (int i = 0; i < endcol - startcol; i++) {
|
||||||
remote_ui_cursor_goto(ui, row, startcol + i);
|
remote_ui_cursor_goto(ui, row, startcol + i);
|
||||||
remote_ui_highlight_set(ui, attrs[i]);
|
remote_ui_highlight_set(ui, attrs[i]);
|
||||||
remote_ui_put(ui, (const char *)chunk[i]);
|
remote_ui_put(ui, chunk[i]);
|
||||||
if (utf_ambiguous_width(utf_ptr2char((char *)chunk[i]))) {
|
if (utf_ambiguous_width(utf_ptr2char((char *)chunk[i]))) {
|
||||||
data->client_col = -1; // force cursor update
|
data->client_col = -1; // force cursor update
|
||||||
}
|
}
|
||||||
|
@ -275,13 +275,13 @@ Dictionary nvim_win_get_config(Window window, Error *err)
|
|||||||
for (size_t i = 0; i < 8; i++) {
|
for (size_t i = 0; i < 8; i++) {
|
||||||
Array tuple = ARRAY_DICT_INIT;
|
Array tuple = ARRAY_DICT_INIT;
|
||||||
|
|
||||||
String s = cstrn_to_string((const char *)config->border_chars[i], sizeof(schar_T));
|
String s = cstrn_to_string(config->border_chars[i], sizeof(schar_T));
|
||||||
|
|
||||||
int hi_id = config->border_hl_ids[i];
|
int hi_id = config->border_hl_ids[i];
|
||||||
char *hi_name = syn_id2name(hi_id);
|
char *hi_name = syn_id2name(hi_id);
|
||||||
if (hi_name[0]) {
|
if (hi_name[0]) {
|
||||||
ADD(tuple, STRING_OBJ(s));
|
ADD(tuple, STRING_OBJ(s));
|
||||||
ADD(tuple, STRING_OBJ(cstr_to_string((const char *)hi_name)));
|
ADD(tuple, STRING_OBJ(cstr_to_string(hi_name)));
|
||||||
ADD(border, ARRAY_OBJ(tuple));
|
ADD(border, ARRAY_OBJ(tuple));
|
||||||
} else {
|
} else {
|
||||||
ADD(border, STRING_OBJ(s));
|
ADD(border, STRING_OBJ(s));
|
||||||
@ -293,10 +293,9 @@ Dictionary nvim_win_get_config(Window window, Error *err)
|
|||||||
VirtText title_datas = config->title_chunks;
|
VirtText title_datas = config->title_chunks;
|
||||||
for (size_t i = 0; i < title_datas.size; i++) {
|
for (size_t i = 0; i < title_datas.size; i++) {
|
||||||
Array tuple = ARRAY_DICT_INIT;
|
Array tuple = ARRAY_DICT_INIT;
|
||||||
ADD(tuple, CSTR_TO_OBJ((const char *)title_datas.items[i].text));
|
ADD(tuple, CSTR_TO_OBJ(title_datas.items[i].text));
|
||||||
if (title_datas.items[i].hl_id > 0) {
|
if (title_datas.items[i].hl_id > 0) {
|
||||||
ADD(tuple,
|
ADD(tuple, STRING_OBJ(cstr_to_string(syn_id2name(title_datas.items[i].hl_id))));
|
||||||
STRING_OBJ(cstr_to_string((const char *)syn_id2name(title_datas.items[i].hl_id))));
|
|
||||||
}
|
}
|
||||||
ADD(titles, ARRAY_OBJ(tuple));
|
ADD(titles, ARRAY_OBJ(tuple));
|
||||||
}
|
}
|
||||||
|
@ -1230,8 +1230,7 @@ static void get_arglist_as_rettv(aentry_T *arglist, int argcount, typval_T *rett
|
|||||||
tv_list_alloc_ret(rettv, argcount);
|
tv_list_alloc_ret(rettv, argcount);
|
||||||
if (arglist != NULL) {
|
if (arglist != NULL) {
|
||||||
for (int idx = 0; idx < argcount; idx++) {
|
for (int idx = 0; idx < argcount; idx++) {
|
||||||
tv_list_append_string(rettv->vval.v_list,
|
tv_list_append_string(rettv->vval.v_list, alist_name(&arglist[idx]), -1);
|
||||||
(const char *)alist_name(&arglist[idx]), -1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1267,7 +1266,7 @@ void f_argv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
rettv->vval.v_string = NULL;
|
rettv->vval.v_string = NULL;
|
||||||
int idx = (int)tv_get_number_chk(&argvars[0], NULL);
|
int idx = (int)tv_get_number_chk(&argvars[0], NULL);
|
||||||
if (arglist != NULL && idx >= 0 && idx < argcount) {
|
if (arglist != NULL && idx >= 0 && idx < argcount) {
|
||||||
rettv->vval.v_string = xstrdup((const char *)alist_name(&arglist[idx]));
|
rettv->vval.v_string = xstrdup(alist_name(&arglist[idx]));
|
||||||
} else if (idx == -1) {
|
} else if (idx == -1) {
|
||||||
get_arglist_as_rettv(arglist, argcount, rettv);
|
get_arglist_as_rettv(arglist, argcount, rettv);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags_arg)
|
|||||||
int save_bin = curbuf->b_p_bin;
|
int save_bin = curbuf->b_p_bin;
|
||||||
int perm;
|
int perm;
|
||||||
|
|
||||||
perm = os_getperm((const char *)curbuf->b_ffname);
|
perm = os_getperm(curbuf->b_ffname);
|
||||||
if (perm >= 0 && (0 || S_ISFIFO(perm)
|
if (perm >= 0 && (0 || S_ISFIFO(perm)
|
||||||
|| S_ISSOCK(perm)
|
|| S_ISSOCK(perm)
|
||||||
# ifdef OPEN_CHR_FILES
|
# ifdef OPEN_CHR_FILES
|
||||||
@ -3309,8 +3309,7 @@ void maketitle(void)
|
|||||||
SPACE_FOR_FNAME + 1);
|
SPACE_FOR_FNAME + 1);
|
||||||
buf_p += MIN(size, SPACE_FOR_FNAME);
|
buf_p += MIN(size, SPACE_FOR_FNAME);
|
||||||
} else {
|
} else {
|
||||||
buf_p += transstr_buf((const char *)path_tail(curbuf->b_fname),
|
buf_p += transstr_buf(path_tail(curbuf->b_fname), -1, buf_p, SPACE_FOR_FNAME + 1, true);
|
||||||
-1, buf_p, SPACE_FOR_FNAME + 1, true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (bufIsChanged(curbuf)
|
switch (bufIsChanged(curbuf)
|
||||||
@ -3557,7 +3556,7 @@ void fname_expand(buf_T *buf, char **ffname, char **sfname)
|
|||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
if (!buf->b_p_bin) {
|
if (!buf->b_p_bin) {
|
||||||
// If the file name is a shortcut file, use the file it links to.
|
// If the file name is a shortcut file, use the file it links to.
|
||||||
char *rfname = os_resolve_shortcut((const char *)(*ffname));
|
char *rfname = os_resolve_shortcut(*ffname);
|
||||||
if (rfname != NULL) {
|
if (rfname != NULL) {
|
||||||
xfree(*ffname);
|
xfree(*ffname);
|
||||||
*ffname = rfname;
|
*ffname = rfname;
|
||||||
|
@ -81,7 +81,7 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
|
|||||||
// allow double close, even though we can't say what parts was valid.
|
// allow double close, even though we can't say what parts was valid.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
*error = (const char *)e_invchan;
|
*error = e_invchan;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,19 +91,19 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
|
|||||||
if (chan->is_rpc) {
|
if (chan->is_rpc) {
|
||||||
rpc_close(chan);
|
rpc_close(chan);
|
||||||
} else if (part == kChannelPartRpc) {
|
} else if (part == kChannelPartRpc) {
|
||||||
*error = (const char *)e_invstream;
|
*error = e_invstream;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if ((part == kChannelPartStdin || part == kChannelPartStdout)
|
} else if ((part == kChannelPartStdin || part == kChannelPartStdout)
|
||||||
&& chan->is_rpc) {
|
&& chan->is_rpc) {
|
||||||
*error = (const char *)e_invstreamrpc;
|
*error = e_invstreamrpc;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chan->streamtype) {
|
switch (chan->streamtype) {
|
||||||
case kChannelStreamSocket:
|
case kChannelStreamSocket:
|
||||||
if (!close_main) {
|
if (!close_main) {
|
||||||
*error = (const char *)e_invstream;
|
*error = e_invstream;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
stream_may_close(&chan->stream.socket);
|
stream_may_close(&chan->stream.socket);
|
||||||
@ -134,14 +134,14 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
|
|||||||
stream_may_close(&chan->stream.stdio.out);
|
stream_may_close(&chan->stream.stdio.out);
|
||||||
}
|
}
|
||||||
if (part == kChannelPartStderr) {
|
if (part == kChannelPartStderr) {
|
||||||
*error = (const char *)e_invstream;
|
*error = e_invstream;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kChannelStreamStderr:
|
case kChannelStreamStderr:
|
||||||
if (part != kChannelPartAll && part != kChannelPartStderr) {
|
if (part != kChannelPartAll && part != kChannelPartStderr) {
|
||||||
*error = (const char *)e_invstream;
|
*error = e_invstream;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!chan->stream.err.closed) {
|
if (!chan->stream.err.closed) {
|
||||||
@ -156,7 +156,7 @@ bool channel_close(uint64_t id, ChannelPart part, const char **error)
|
|||||||
|
|
||||||
case kChannelStreamInternal:
|
case kChannelStreamInternal:
|
||||||
if (!close_main) {
|
if (!close_main) {
|
||||||
*error = (const char *)e_invstream;
|
*error = e_invstream;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (chan->term) {
|
if (chan->term) {
|
||||||
|
@ -389,7 +389,7 @@ size_t transstr_buf(const char *const s, const ssize_t slen, char *const buf, co
|
|||||||
} else if (*p == TAB && !untab) {
|
} else if (*p == TAB && !untab) {
|
||||||
*buf_p++ = *p++;
|
*buf_p++ = *p++;
|
||||||
} else {
|
} else {
|
||||||
const char *const tb = (const char *)transchar_byte((uint8_t)(*p++));
|
const char *const tb = transchar_byte((uint8_t)(*p++));
|
||||||
const size_t tb_len = strlen(tb);
|
const size_t tb_len = strlen(tb);
|
||||||
if (buf_p + tb_len > buf_e) {
|
if (buf_p + tb_len > buf_e) {
|
||||||
break; // Exceeded `buf` size.
|
break; // Exceeded `buf` size.
|
||||||
|
@ -959,7 +959,7 @@ static void showmatches_oneline(expand_T *xp, char **matches, int numMatches, in
|
|||||||
msg_outtrans_attr(matches[j], HL_ATTR(HLF_D));
|
msg_outtrans_attr(matches[j], HL_ATTR(HLF_D));
|
||||||
p = matches[j] + strlen(matches[j]) + 1;
|
p = matches[j] + strlen(matches[j]) + 1;
|
||||||
msg_advance(maxlen + 1);
|
msg_advance(maxlen + 1);
|
||||||
msg_puts((const char *)p);
|
msg_puts(p);
|
||||||
msg_advance(maxlen + 3);
|
msg_advance(maxlen + 3);
|
||||||
msg_outtrans_long_attr(p + 2, HL_ATTR(HLF_D));
|
msg_outtrans_long_attr(p + 2, HL_ATTR(HLF_D));
|
||||||
break;
|
break;
|
||||||
@ -1438,7 +1438,7 @@ static const char *set_cmd_index(const char *cmd, exarg_T *eap, expand_T *xp, in
|
|||||||
p = cmd + 1;
|
p = cmd + 1;
|
||||||
} else if (cmd[0] >= 'A' && cmd[0] <= 'Z') {
|
} else if (cmd[0] >= 'A' && cmd[0] <= 'Z') {
|
||||||
eap->cmd = (char *)cmd;
|
eap->cmd = (char *)cmd;
|
||||||
p = (const char *)find_ucmd(eap, (char *)p, NULL, xp, complp);
|
p = find_ucmd(eap, (char *)p, NULL, xp, complp);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
eap->cmdidx = CMD_SIZE; // Ambiguous user command.
|
eap->cmdidx = CMD_SIZE; // Ambiguous user command.
|
||||||
}
|
}
|
||||||
@ -1464,7 +1464,7 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
|
|||||||
// Allow spaces within back-quotes to count as part of the argument
|
// Allow spaces within back-quotes to count as part of the argument
|
||||||
// being expanded.
|
// being expanded.
|
||||||
xp->xp_pattern = skipwhite(arg);
|
xp->xp_pattern = skipwhite(arg);
|
||||||
const char *p = (const char *)xp->xp_pattern;
|
const char *p = xp->xp_pattern;
|
||||||
while (*p != NUL) {
|
while (*p != NUL) {
|
||||||
int c = utf_ptr2char(p);
|
int c = utf_ptr2char(p);
|
||||||
if (c == '\\' && p[1] != NUL) {
|
if (c == '\\' && p[1] != NUL) {
|
||||||
@ -1517,7 +1517,7 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
|
|||||||
|
|
||||||
// Check for environment variable.
|
// Check for environment variable.
|
||||||
if (*xp->xp_pattern == '$') {
|
if (*xp->xp_pattern == '$') {
|
||||||
for (p = (const char *)xp->xp_pattern + 1; *p != NUL; p++) {
|
for (p = xp->xp_pattern + 1; *p != NUL; p++) {
|
||||||
if (!vim_isIDc((uint8_t)(*p))) {
|
if (!vim_isIDc((uint8_t)(*p))) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1533,12 +1533,11 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
|
|||||||
}
|
}
|
||||||
// Check for user names.
|
// Check for user names.
|
||||||
if (*xp->xp_pattern == '~') {
|
if (*xp->xp_pattern == '~') {
|
||||||
for (p = (const char *)xp->xp_pattern + 1; *p != NUL && *p != '/'; p++) {}
|
for (p = xp->xp_pattern + 1; *p != NUL && *p != '/'; p++) {}
|
||||||
// Complete ~user only if it partially matches a user name.
|
// Complete ~user only if it partially matches a user name.
|
||||||
// A full match ~user<Tab> will be replaced by user's home
|
// A full match ~user<Tab> will be replaced by user's home
|
||||||
// directory i.e. something like ~user<Tab> -> /home/user/
|
// directory i.e. something like ~user<Tab> -> /home/user/
|
||||||
if (*p == NUL && p > (const char *)xp->xp_pattern + 1
|
if (*p == NUL && p > xp->xp_pattern + 1 && match_user(xp->xp_pattern + 1) >= 1) {
|
||||||
&& match_user(xp->xp_pattern + 1) >= 1) {
|
|
||||||
xp->xp_context = EXPAND_USER;
|
xp->xp_context = EXPAND_USER;
|
||||||
xp->xp_pattern++;
|
xp->xp_pattern++;
|
||||||
}
|
}
|
||||||
@ -1550,13 +1549,13 @@ static void set_context_for_wildcard_arg(exarg_T *eap, const char *arg, bool use
|
|||||||
static const char *set_context_in_filter_cmd(expand_T *xp, const char *arg)
|
static const char *set_context_in_filter_cmd(expand_T *xp, const char *arg)
|
||||||
{
|
{
|
||||||
if (*arg != NUL) {
|
if (*arg != NUL) {
|
||||||
arg = (const char *)skip_vimgrep_pat((char *)arg, NULL, NULL);
|
arg = skip_vimgrep_pat((char *)arg, NULL, NULL);
|
||||||
}
|
}
|
||||||
if (arg == NULL || *arg == NUL) {
|
if (arg == NULL || *arg == NUL) {
|
||||||
xp->xp_context = EXPAND_NOTHING;
|
xp->xp_context = EXPAND_NOTHING;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return (const char *)skipwhite(arg);
|
return skipwhite(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the completion context for the :match command. Returns a pointer to the
|
/// Set the completion context for the :match command. Returns a pointer to the
|
||||||
@ -1566,13 +1565,13 @@ static const char *set_context_in_match_cmd(expand_T *xp, const char *arg)
|
|||||||
if (*arg == NUL || !ends_excmd(*arg)) {
|
if (*arg == NUL || !ends_excmd(*arg)) {
|
||||||
// also complete "None"
|
// also complete "None"
|
||||||
set_context_in_echohl_cmd(xp, arg);
|
set_context_in_echohl_cmd(xp, arg);
|
||||||
arg = (const char *)skipwhite(skiptowhite(arg));
|
arg = skipwhite(skiptowhite(arg));
|
||||||
if (*arg != NUL) {
|
if (*arg != NUL) {
|
||||||
xp->xp_context = EXPAND_NOTHING;
|
xp->xp_context = EXPAND_NOTHING;
|
||||||
arg = (const char *)skip_regexp((char *)arg + 1, (uint8_t)(*arg), magic_isset());
|
arg = skip_regexp((char *)arg + 1, (uint8_t)(*arg), magic_isset());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return (const char *)find_nextcmd(arg);
|
return find_nextcmd(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a pointer to the next command after a :global or a :v command.
|
/// Returns a pointer to the next command after a :global or a :v command.
|
||||||
@ -1605,7 +1604,7 @@ static const char *find_cmd_after_substitute_cmd(const char *arg)
|
|||||||
if (delim) {
|
if (delim) {
|
||||||
// Skip "from" part.
|
// Skip "from" part.
|
||||||
arg++;
|
arg++;
|
||||||
arg = (const char *)skip_regexp((char *)arg, delim, magic_isset());
|
arg = skip_regexp((char *)arg, delim, magic_isset());
|
||||||
|
|
||||||
if (arg[0] != NUL && arg[0] == delim) {
|
if (arg[0] != NUL && arg[0] == delim) {
|
||||||
// Skip "to" part.
|
// Skip "to" part.
|
||||||
@ -1637,7 +1636,7 @@ static const char *find_cmd_after_substitute_cmd(const char *arg)
|
|||||||
static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
|
static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
|
||||||
{
|
{
|
||||||
// Skip count.
|
// Skip count.
|
||||||
arg = (const char *)skipwhite(skipdigits(arg));
|
arg = skipwhite(skipdigits(arg));
|
||||||
if (*arg != '/') {
|
if (*arg != '/') {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -1649,7 +1648,7 @@ static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*arg) {
|
if (*arg) {
|
||||||
arg = (const char *)skipwhite(arg + 1);
|
arg = skipwhite(arg + 1);
|
||||||
|
|
||||||
// Check for trailing illegal characters.
|
// Check for trailing illegal characters.
|
||||||
if (*arg == NUL || strchr("|\"\n", *arg) == NULL) {
|
if (*arg == NUL || strchr("|\"\n", *arg) == NULL) {
|
||||||
@ -1666,7 +1665,7 @@ static const char *find_cmd_after_isearch_cmd(expand_T *xp, const char *arg)
|
|||||||
static const char *set_context_in_unlet_cmd(expand_T *xp, const char *arg)
|
static const char *set_context_in_unlet_cmd(expand_T *xp, const char *arg)
|
||||||
{
|
{
|
||||||
while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) {
|
while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) {
|
||||||
arg = (const char *)xp->xp_pattern + 1;
|
arg = xp->xp_pattern + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
xp->xp_context = EXPAND_USER_VARS;
|
xp->xp_context = EXPAND_USER_VARS;
|
||||||
@ -1683,7 +1682,7 @@ static const char *set_context_in_unlet_cmd(expand_T *xp, const char *arg)
|
|||||||
/// Set the completion context for the :language command. Always returns NULL.
|
/// Set the completion context for the :language command. Always returns NULL.
|
||||||
static const char *set_context_in_lang_cmd(expand_T *xp, const char *arg)
|
static const char *set_context_in_lang_cmd(expand_T *xp, const char *arg)
|
||||||
{
|
{
|
||||||
const char *p = (const char *)skiptowhite(arg);
|
const char *p = skiptowhite(arg);
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
xp->xp_context = EXPAND_LANGUAGE;
|
xp->xp_context = EXPAND_LANGUAGE;
|
||||||
xp->xp_pattern = (char *)arg;
|
xp->xp_pattern = (char *)arg;
|
||||||
@ -1876,11 +1875,11 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
|
|||||||
case CMD_dsplit:
|
case CMD_dsplit:
|
||||||
return find_cmd_after_isearch_cmd(xp, arg);
|
return find_cmd_after_isearch_cmd(xp, arg);
|
||||||
case CMD_autocmd:
|
case CMD_autocmd:
|
||||||
return (const char *)set_context_in_autocmd(xp, (char *)arg, false);
|
return set_context_in_autocmd(xp, (char *)arg, false);
|
||||||
|
|
||||||
case CMD_doautocmd:
|
case CMD_doautocmd:
|
||||||
case CMD_doautoall:
|
case CMD_doautoall:
|
||||||
return (const char *)set_context_in_autocmd(xp, (char *)arg, true);
|
return set_context_in_autocmd(xp, (char *)arg, true);
|
||||||
case CMD_set:
|
case CMD_set:
|
||||||
set_context_in_set_cmd(xp, (char *)arg, 0);
|
set_context_in_set_cmd(xp, (char *)arg, 0);
|
||||||
break;
|
break;
|
||||||
@ -1957,7 +1956,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
|
|||||||
case CMD_bwipeout:
|
case CMD_bwipeout:
|
||||||
case CMD_bunload:
|
case CMD_bunload:
|
||||||
while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) {
|
while ((xp->xp_pattern = strchr(arg, ' ')) != NULL) {
|
||||||
arg = (const char *)xp->xp_pattern + 1;
|
arg = xp->xp_pattern + 1;
|
||||||
}
|
}
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case CMD_buffer:
|
case CMD_buffer:
|
||||||
@ -2063,7 +2062,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
|
|||||||
case CMD_tunmenu:
|
case CMD_tunmenu:
|
||||||
case CMD_popup:
|
case CMD_popup:
|
||||||
case CMD_emenu:
|
case CMD_emenu:
|
||||||
return (const char *)set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
|
return set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
|
||||||
|
|
||||||
case CMD_colorscheme:
|
case CMD_colorscheme:
|
||||||
xp->xp_context = EXPAND_COLORS;
|
xp->xp_context = EXPAND_COLORS;
|
||||||
@ -2126,7 +2125,7 @@ static const char *set_context_by_cmdname(const char *cmd, cmdidx_T cmdidx, expa
|
|||||||
|
|
||||||
case CMD_argdelete:
|
case CMD_argdelete:
|
||||||
while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) {
|
while ((xp->xp_pattern = vim_strchr(arg, ' ')) != NULL) {
|
||||||
arg = (const char *)(xp->xp_pattern + 1);
|
arg = (xp->xp_pattern + 1);
|
||||||
}
|
}
|
||||||
xp->xp_context = EXPAND_ARGLIST;
|
xp->xp_context = EXPAND_ARGLIST;
|
||||||
xp->xp_pattern = (char *)arg;
|
xp->xp_pattern = (char *)arg;
|
||||||
@ -2186,7 +2185,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. skip over a range specifier of the form: addr [,addr] [;addr] ..
|
// 3. skip over a range specifier of the form: addr [,addr] [;addr] ..
|
||||||
cmd = (const char *)skip_range(cmd, &xp->xp_context);
|
cmd = skip_range(cmd, &xp->xp_context);
|
||||||
xp->xp_pattern = (char *)cmd;
|
xp->xp_pattern = (char *)cmd;
|
||||||
if (*cmd == NUL) {
|
if (*cmd == NUL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -2218,7 +2217,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
ea.argt = excmd_get_argt(ea.cmdidx);
|
ea.argt = excmd_get_argt(ea.cmdidx);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *arg = (const char *)skipwhite(p);
|
const char *arg = skipwhite(p);
|
||||||
|
|
||||||
// Skip over ++argopt argument
|
// Skip over ++argopt argument
|
||||||
if ((ea.argt & EX_ARGOPT) && *arg != NUL && strncmp(arg, "++", 2) == 0) {
|
if ((ea.argt & EX_ARGOPT) && *arg != NUL && strncmp(arg, "++", 2) == 0) {
|
||||||
@ -2226,7 +2225,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
while (*p && !ascii_isspace(*p)) {
|
while (*p && !ascii_isspace(*p)) {
|
||||||
MB_PTR_ADV(p);
|
MB_PTR_ADV(p);
|
||||||
}
|
}
|
||||||
arg = (const char *)skipwhite(p);
|
arg = skipwhite(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) {
|
if (ea.cmdidx == CMD_write || ea.cmdidx == CMD_update) {
|
||||||
@ -2234,7 +2233,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
if (*++arg == '>') {
|
if (*++arg == '>') {
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
arg = (const char *)skipwhite(arg);
|
arg = skipwhite(arg);
|
||||||
} else if (*arg == '!' && ea.cmdidx == CMD_write) { // :w !filter
|
} else if (*arg == '!' && ea.cmdidx == CMD_write) { // :w !filter
|
||||||
arg++;
|
arg++;
|
||||||
usefilter = true;
|
usefilter = true;
|
||||||
@ -2253,14 +2252,14 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
while (*arg == *cmd) { // allow any number of '>' or '<'
|
while (*arg == *cmd) { // allow any number of '>' or '<'
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
arg = (const char *)skipwhite(arg);
|
arg = skipwhite(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does command allow "+command"?
|
// Does command allow "+command"?
|
||||||
if ((ea.argt & EX_CMDARG) && !usefilter && *arg == '+') {
|
if ((ea.argt & EX_CMDARG) && !usefilter && *arg == '+') {
|
||||||
// Check if we're in the +command
|
// Check if we're in the +command
|
||||||
p = arg + 1;
|
p = arg + 1;
|
||||||
arg = (const char *)skip_cmd_arg((char *)arg, false);
|
arg = skip_cmd_arg((char *)arg, false);
|
||||||
|
|
||||||
// Still touching the command after '+'?
|
// Still touching the command after '+'?
|
||||||
if (*arg == NUL) {
|
if (*arg == NUL) {
|
||||||
@ -2268,7 +2267,7 @@ static const char *set_one_cmd_context(expand_T *xp, const char *buff)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Skip space(s) after +command to get to the real argument.
|
// Skip space(s) after +command to get to the real argument.
|
||||||
arg = (const char *)skipwhite(arg);
|
arg = skipwhite(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check for '|' to separate commands and '"' to start comments.
|
// Check for '|' to separate commands and '"' to start comments.
|
||||||
@ -2344,7 +2343,7 @@ void set_cmd_context(expand_T *xp, char *str, int len, int col, int use_ccline)
|
|||||||
old_char = str[col];
|
old_char = str[col];
|
||||||
}
|
}
|
||||||
str[col] = NUL;
|
str[col] = NUL;
|
||||||
const char *nextcomm = (const char *)str;
|
const char *nextcomm = str;
|
||||||
|
|
||||||
if (use_ccline && ccline->cmdfirstc == '=') {
|
if (use_ccline && ccline->cmdfirstc == '=') {
|
||||||
// pass CMD_SIZE because there is no real command
|
// pass CMD_SIZE because there is no real command
|
||||||
@ -2922,7 +2921,7 @@ static void expand_shellcmd_onedir(char *buf, char *s, size_t l, char *pat, char
|
|||||||
// Check if this name was already found.
|
// Check if this name was already found.
|
||||||
hash_T hash = hash_hash(name + l);
|
hash_T hash = hash_hash(name + l);
|
||||||
hashitem_T *hi =
|
hashitem_T *hi =
|
||||||
hash_lookup(ht, (const char *)(name + l), strlen(name + l), hash);
|
hash_lookup(ht, name + l, strlen(name + l), hash);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
// Remove the path that was prepended.
|
// Remove the path that was prepended.
|
||||||
STRMOVE(name, name + l);
|
STRMOVE(name, name + l);
|
||||||
@ -3166,7 +3165,7 @@ static int ExpandUserList(expand_T *xp, char ***matches, int *numMatches)
|
|||||||
continue; // Skip non-string items and empty strings.
|
continue; // Skip non-string items and empty strings.
|
||||||
}
|
}
|
||||||
|
|
||||||
GA_APPEND(char *, &ga, xstrdup((const char *)TV_LIST_ITEM_TV(li)->vval.v_string));
|
GA_APPEND(char *, &ga, xstrdup(TV_LIST_ITEM_TV(li)->vval.v_string));
|
||||||
});
|
});
|
||||||
tv_list_unref(retlist);
|
tv_list_unref(retlist);
|
||||||
|
|
||||||
@ -3195,7 +3194,7 @@ static int ExpandUserLua(expand_T *xp, int *num_file, char ***file)
|
|||||||
continue; // Skip non-string items and empty strings.
|
continue; // Skip non-string items and empty strings.
|
||||||
}
|
}
|
||||||
|
|
||||||
GA_APPEND(char *, &ga, xstrdup((const char *)TV_LIST_ITEM_TV(li)->vval.v_string));
|
GA_APPEND(char *, &ga, xstrdup(TV_LIST_ITEM_TV(li)->vval.v_string));
|
||||||
});
|
});
|
||||||
tv_list_unref(retlist);
|
tv_list_unref(retlist);
|
||||||
|
|
||||||
@ -3551,8 +3550,7 @@ theend:
|
|||||||
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
|
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
|
||||||
|
|
||||||
for (int i = 0; i < xpc.xp_numfiles; i++) {
|
for (int i = 0; i < xpc.xp_numfiles; i++) {
|
||||||
tv_list_append_string(rettv->vval.v_list, (const char *)xpc.xp_files[i],
|
tv_list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
|
||||||
-1);
|
|
||||||
}
|
}
|
||||||
xfree(pat);
|
xfree(pat);
|
||||||
ExpandCleanup(&xpc);
|
ExpandCleanup(&xpc);
|
||||||
|
@ -2699,7 +2699,7 @@ int stuff_inserted(int c, long count, int no_esc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
do {
|
do {
|
||||||
stuffReadbuff((const char *)ptr);
|
stuffReadbuff(ptr);
|
||||||
// A trailing "0" is inserted as "<C-V>048", "^" as "<C-V>^".
|
// A trailing "0" is inserted as "<C-V>048", "^" as "<C-V>^".
|
||||||
if (last) {
|
if (last) {
|
||||||
stuffReadbuff(last == '0' ? "\026\060\064\070" : "\026^");
|
stuffReadbuff(last == '0' ? "\026\060\064\070" : "\026^");
|
||||||
|
@ -1234,9 +1234,8 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
|
|||||||
|
|
||||||
if (skip) {
|
if (skip) {
|
||||||
// When skipping just find the end of the name.
|
// When skipping just find the end of the name.
|
||||||
lp->ll_name = (const char *)name;
|
lp->ll_name = name;
|
||||||
return (char *)find_name_end(name, NULL, NULL,
|
return (char *)find_name_end(name, NULL, NULL, FNE_INCL_BR | fne_flags);
|
||||||
FNE_INCL_BR | fne_flags);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the end of the name.
|
// Find the end of the name.
|
||||||
@ -1269,8 +1268,8 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
|
|||||||
lp->ll_name_len = strlen(lp->ll_name);
|
lp->ll_name_len = strlen(lp->ll_name);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lp->ll_name = (const char *)name;
|
lp->ll_name = name;
|
||||||
lp->ll_name_len = (size_t)((const char *)p - lp->ll_name);
|
lp->ll_name_len = (size_t)(p - lp->ll_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Without [idx] or .key we are done.
|
// Without [idx] or .key we are done.
|
||||||
@ -1417,7 +1416,7 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
|
|||||||
}
|
}
|
||||||
lp->ll_list = NULL;
|
lp->ll_list = NULL;
|
||||||
lp->ll_dict = lp->ll_tv->vval.v_dict;
|
lp->ll_dict = lp->ll_tv->vval.v_dict;
|
||||||
lp->ll_di = tv_dict_find(lp->ll_dict, (const char *)key, len);
|
lp->ll_di = tv_dict_find(lp->ll_dict, key, len);
|
||||||
|
|
||||||
// When assigning to a scope dictionary check that a function and
|
// When assigning to a scope dictionary check that a function and
|
||||||
// variable name is valid (only variable name unless it is l: or
|
// variable name is valid (only variable name unless it is l: or
|
||||||
@ -1434,8 +1433,8 @@ char *get_lval(char *const name, typval_T *const rettv, lval_T *const lp, const
|
|||||||
}
|
}
|
||||||
wrong = ((lp->ll_dict->dv_scope == VAR_DEF_SCOPE
|
wrong = ((lp->ll_dict->dv_scope == VAR_DEF_SCOPE
|
||||||
&& tv_is_func(*rettv)
|
&& tv_is_func(*rettv)
|
||||||
&& var_wrong_func_name((const char *)key, lp->ll_di == NULL))
|
&& var_wrong_func_name(key, lp->ll_di == NULL))
|
||||||
|| !valid_varname((const char *)key));
|
|| !valid_varname(key));
|
||||||
if (len != -1) {
|
if (len != -1) {
|
||||||
key[len] = prevval;
|
key[len] = prevval;
|
||||||
}
|
}
|
||||||
@ -1728,7 +1727,7 @@ void set_var_lval(lval_T *lp, char *endp, typval_T *rettv, int copy, const bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to add an item to the Dictionary.
|
// Need to add an item to the Dictionary.
|
||||||
di = tv_dict_item_alloc((const char *)lp->ll_newkey);
|
di = tv_dict_item_alloc(lp->ll_newkey);
|
||||||
if (tv_dict_add(lp->ll_tv->vval.v_dict, di) == FAIL) {
|
if (tv_dict_add(lp->ll_tv->vval.v_dict, di) == FAIL) {
|
||||||
xfree(di);
|
xfree(di);
|
||||||
return;
|
return;
|
||||||
@ -2172,13 +2171,13 @@ static int eval_func(char **const arg, char *const name, const int name_len, typ
|
|||||||
int len = name_len;
|
int len = name_len;
|
||||||
|
|
||||||
if (!evaluate) {
|
if (!evaluate) {
|
||||||
check_vars((const char *)s, (size_t)len);
|
check_vars(s, (size_t)len);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If "s" is the name of a variable of type VAR_FUNC
|
// If "s" is the name of a variable of type VAR_FUNC
|
||||||
// use its contents.
|
// use its contents.
|
||||||
partial_T *partial;
|
partial_T *partial;
|
||||||
s = deref_func_name((const char *)s, &len, &partial, !evaluate);
|
s = deref_func_name(s, &len, &partial, !evaluate);
|
||||||
|
|
||||||
// Need to make a copy, in case evaluating the arguments makes
|
// Need to make a copy, in case evaluating the arguments makes
|
||||||
// the name invalid.
|
// the name invalid.
|
||||||
@ -3000,9 +2999,9 @@ static int eval7(char **arg, typval_T *rettv, int evaluate, int want_string)
|
|||||||
if (**arg == '(') { // recursive!
|
if (**arg == '(') { // recursive!
|
||||||
ret = eval_func(arg, s, len, rettv, evaluate, NULL);
|
ret = eval_func(arg, s, len, rettv, evaluate, NULL);
|
||||||
} else if (evaluate) {
|
} else if (evaluate) {
|
||||||
ret = get_var_tv((const char *)s, len, rettv, NULL, true, false);
|
ret = get_var_tv(s, len, rettv, NULL, true, false);
|
||||||
} else {
|
} else {
|
||||||
check_vars((const char *)s, (size_t)len);
|
check_vars(s, (size_t)len);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3199,7 +3198,7 @@ static int eval_method(char **const arg, typval_T *const rettv, const bool evalu
|
|||||||
char *lua_funcname = NULL;
|
char *lua_funcname = NULL;
|
||||||
if (strncmp(name, "v:lua.", 6) == 0) {
|
if (strncmp(name, "v:lua.", 6) == 0) {
|
||||||
lua_funcname = name + 6;
|
lua_funcname = name + 6;
|
||||||
*arg = (char *)skip_luafunc_name((const char *)lua_funcname);
|
*arg = (char *)skip_luafunc_name(lua_funcname);
|
||||||
*arg = skipwhite(*arg); // to detect trailing whitespace later
|
*arg = skipwhite(*arg); // to detect trailing whitespace later
|
||||||
len = (int)(*arg - lua_funcname);
|
len = (int)(*arg - lua_funcname);
|
||||||
} else {
|
} else {
|
||||||
@ -3520,8 +3519,7 @@ static int eval_index(char **arg, typval_T *rettv, int evaluate, int verbose)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dictitem_T *const item = tv_dict_find(rettv->vval.v_dict,
|
dictitem_T *const item = tv_dict_find(rettv->vval.v_dict, key, len);
|
||||||
(const char *)key, len);
|
|
||||||
|
|
||||||
if (item == NULL && verbose) {
|
if (item == NULL && verbose) {
|
||||||
semsg(_(e_dictkey), key);
|
semsg(_(e_dictkey), key);
|
||||||
@ -4635,14 +4633,14 @@ static int eval_dict(char **arg, typval_T *rettv, int evaluate, bool literal)
|
|||||||
goto failret;
|
goto failret;
|
||||||
}
|
}
|
||||||
if (evaluate) {
|
if (evaluate) {
|
||||||
dictitem_T *item = tv_dict_find(d, (const char *)key, -1);
|
dictitem_T *item = tv_dict_find(d, key, -1);
|
||||||
if (item != NULL) {
|
if (item != NULL) {
|
||||||
semsg(_("E721: Duplicate key in Dictionary: \"%s\""), key);
|
semsg(_("E721: Duplicate key in Dictionary: \"%s\""), key);
|
||||||
tv_clear(&tvkey);
|
tv_clear(&tvkey);
|
||||||
tv_clear(&tv);
|
tv_clear(&tv);
|
||||||
goto failret;
|
goto failret;
|
||||||
}
|
}
|
||||||
item = tv_dict_item_alloc((const char *)key);
|
item = tv_dict_item_alloc(key);
|
||||||
item->di_tv = tv;
|
item->di_tv = tv;
|
||||||
item->di_tv.v_lock = VAR_UNLOCKED;
|
item->di_tv.v_lock = VAR_UNLOCKED;
|
||||||
if (tv_dict_add(d, item) == FAIL) {
|
if (tv_dict_add(d, item) == FAIL) {
|
||||||
@ -4755,8 +4753,7 @@ void assert_error(garray_T *gap)
|
|||||||
// Make sure v:errors is a list.
|
// Make sure v:errors is a list.
|
||||||
set_vim_var_list(VV_ERRORS, tv_list_alloc(1));
|
set_vim_var_list(VV_ERRORS, tv_list_alloc(1));
|
||||||
}
|
}
|
||||||
tv_list_append_string(vimvars[VV_ERRORS].vv_list,
|
tv_list_append_string(vimvars[VV_ERRORS].vv_list, gap->ga_data, (ptrdiff_t)gap->ga_len);
|
||||||
(const char *)gap->ga_data, (ptrdiff_t)gap->ga_len);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Implementation of map() and filter().
|
/// Implementation of map() and filter().
|
||||||
@ -4983,14 +4980,12 @@ void common_function(typval_T *argvars, typval_T *rettv, bool is_funcref)
|
|||||||
}
|
}
|
||||||
if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s))
|
if (s == NULL || *s == NUL || (use_string && ascii_isdigit(*s))
|
||||||
|| (is_funcref && trans_name == NULL)) {
|
|| (is_funcref && trans_name == NULL)) {
|
||||||
semsg(_(e_invarg2), (use_string
|
semsg(_(e_invarg2), (use_string ? tv_get_string(&argvars[0]) : s));
|
||||||
? tv_get_string(&argvars[0])
|
|
||||||
: (const char *)s));
|
|
||||||
// Don't check an autoload name for existence here.
|
// Don't check an autoload name for existence here.
|
||||||
} else if (trans_name != NULL
|
} else if (trans_name != NULL
|
||||||
&& (is_funcref
|
&& (is_funcref
|
||||||
? find_func(trans_name) == NULL
|
? find_func(trans_name) == NULL
|
||||||
: !translated_function_exists((const char *)trans_name))) {
|
: !translated_function_exists(trans_name))) {
|
||||||
semsg(_("E700: Unknown function: %s"), s);
|
semsg(_("E700: Unknown function: %s"), s);
|
||||||
} else {
|
} else {
|
||||||
int dict_idx = 0;
|
int dict_idx = 0;
|
||||||
@ -6338,7 +6333,7 @@ int get_id_len(const char **const arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
len = (int)(p - *arg);
|
len = (int)(p - *arg);
|
||||||
*arg = (const char *)skipwhite(p);
|
*arg = skipwhite(p);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
@ -6376,7 +6371,7 @@ int get_name_len(const char **const arg, char **alias, bool evaluate, bool verbo
|
|||||||
if (expr_start != NULL) {
|
if (expr_start != NULL) {
|
||||||
if (!evaluate) {
|
if (!evaluate) {
|
||||||
len += (int)(p - *arg);
|
len += (int)(p - *arg);
|
||||||
*arg = (const char *)skipwhite(p);
|
*arg = skipwhite(p);
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6387,7 +6382,7 @@ int get_name_len(const char **const arg, char **alias, bool evaluate, bool verbo
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
*alias = temp_string;
|
*alias = temp_string;
|
||||||
*arg = (const char *)skipwhite(p);
|
*arg = skipwhite(p);
|
||||||
return (int)strlen(temp_string);
|
return (int)strlen(temp_string);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8165,7 +8160,7 @@ void script_host_eval(char *name, typval_T *argvars, typval_T *rettv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
list_T *args = tv_list_alloc(1);
|
list_T *args = tv_list_alloc(1);
|
||||||
tv_list_append_string(args, (const char *)argvars[0].vval.v_string, -1);
|
tv_list_append_string(args, argvars[0].vval.v_string, -1);
|
||||||
*rettv = eval_call_provider(name, "eval", args, false);
|
*rettv = eval_call_provider(name, "eval", args, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,8 +487,7 @@ static dict_T *get_buffer_info(buf_T *buf)
|
|||||||
dict_T *const dict = tv_dict_alloc();
|
dict_T *const dict = tv_dict_alloc();
|
||||||
|
|
||||||
tv_dict_add_nr(dict, S_LEN("bufnr"), buf->b_fnum);
|
tv_dict_add_nr(dict, S_LEN("bufnr"), buf->b_fnum);
|
||||||
tv_dict_add_str(dict, S_LEN("name"),
|
tv_dict_add_str(dict, S_LEN("name"), buf->b_ffname != NULL ? buf->b_ffname : "");
|
||||||
buf->b_ffname != NULL ? (const char *)buf->b_ffname : "");
|
|
||||||
tv_dict_add_nr(dict, S_LEN("lnum"),
|
tv_dict_add_nr(dict, S_LEN("lnum"),
|
||||||
buf == curbuf ? curwin->w_cursor.lnum : buflist_findlnum(buf));
|
buf == curbuf ? curwin->w_cursor.lnum : buflist_findlnum(buf));
|
||||||
tv_dict_add_nr(dict, S_LEN("linecount"), buf->b_ml.ml_line_count);
|
tv_dict_add_nr(dict, S_LEN("linecount"), buf->b_ml.ml_line_count);
|
||||||
@ -496,8 +495,7 @@ static dict_T *get_buffer_info(buf_T *buf)
|
|||||||
tv_dict_add_nr(dict, S_LEN("listed"), buf->b_p_bl);
|
tv_dict_add_nr(dict, S_LEN("listed"), buf->b_p_bl);
|
||||||
tv_dict_add_nr(dict, S_LEN("changed"), bufIsChanged(buf));
|
tv_dict_add_nr(dict, S_LEN("changed"), bufIsChanged(buf));
|
||||||
tv_dict_add_nr(dict, S_LEN("changedtick"), buf_get_changedtick(buf));
|
tv_dict_add_nr(dict, S_LEN("changedtick"), buf_get_changedtick(buf));
|
||||||
tv_dict_add_nr(dict, S_LEN("hidden"),
|
tv_dict_add_nr(dict, S_LEN("hidden"), buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0);
|
||||||
buf->b_ml.ml_mfp != NULL && buf->b_nwindows == 0);
|
|
||||||
|
|
||||||
// Get a reference to buffer variables
|
// Get a reference to buffer variables
|
||||||
tv_dict_add_dict(dict, S_LEN("variables"), buf->b_vars);
|
tv_dict_add_dict(dict, S_LEN("variables"), buf->b_vars);
|
||||||
@ -609,8 +607,7 @@ static void get_buffer_lines(buf_T *buf, linenr_T start, linenr_T end, int retli
|
|||||||
}
|
}
|
||||||
tv_list_alloc_ret(rettv, end - start + 1);
|
tv_list_alloc_ret(rettv, end - start + 1);
|
||||||
while (start <= end) {
|
while (start <= end) {
|
||||||
tv_list_append_string(rettv->vval.v_list,
|
tv_list_append_string(rettv->vval.v_list, ml_get_buf(buf, start++, false), -1);
|
||||||
(const char *)ml_get_buf(buf, start++, false), -1);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rettv->v_type = VAR_STRING;
|
rettv->v_type = VAR_STRING;
|
||||||
|
@ -148,7 +148,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
|
|||||||
assert(!(key.is_special_string
|
assert(!(key.is_special_string
|
||||||
|| key.val.vval.v_string == NULL
|
|| key.val.vval.v_string == NULL
|
||||||
|| *key.val.vval.v_string == NUL));
|
|| *key.val.vval.v_string == NUL));
|
||||||
dictitem_T *const obj_di = tv_dict_item_alloc((const char *)key.val.vval.v_string);
|
dictitem_T *const obj_di = tv_dict_item_alloc(key.val.vval.v_string);
|
||||||
tv_clear(&key.val);
|
tv_clear(&key.val);
|
||||||
if (tv_dict_add(last_container.container.vval.v_dict, obj_di)
|
if (tv_dict_add(last_container.container.vval.v_dict, obj_di)
|
||||||
== FAIL) {
|
== FAIL) {
|
||||||
@ -179,8 +179,7 @@ static inline int json_decoder_pop(ValuesStackItem obj, ValuesStack *const stack
|
|||||||
&& (obj.is_special_string
|
&& (obj.is_special_string
|
||||||
|| obj.val.vval.v_string == NULL
|
|| obj.val.vval.v_string == NULL
|
||||||
|| *obj.val.vval.v_string == NUL
|
|| *obj.val.vval.v_string == NUL
|
||||||
|| tv_dict_find(last_container.container.vval.v_dict,
|
|| tv_dict_find(last_container.container.vval.v_dict, obj.val.vval.v_string, -1))) {
|
||||||
(const char *)obj.val.vval.v_string, -1))) {
|
|
||||||
tv_clear(&obj.val);
|
tv_clear(&obj.val);
|
||||||
|
|
||||||
// Restart
|
// Restart
|
||||||
|
@ -298,7 +298,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
|
|||||||
|
|
||||||
#define TYPVAL_ENCODE_CONV_STRING(tv, buf, len) \
|
#define TYPVAL_ENCODE_CONV_STRING(tv, buf, len) \
|
||||||
do { \
|
do { \
|
||||||
const char *const buf_ = (const char *)(buf); \
|
const char *const buf_ = (buf); \
|
||||||
if ((buf) == NULL) { \
|
if ((buf) == NULL) { \
|
||||||
ga_concat(gap, "''"); \
|
ga_concat(gap, "''"); \
|
||||||
} else { \
|
} else { \
|
||||||
@ -376,7 +376,7 @@ int encode_read_from_list(ListReaderState *const state, char *const buf, const s
|
|||||||
|
|
||||||
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
|
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
|
||||||
do { \
|
do { \
|
||||||
const char *const fun_ = (const char *)(fun); \
|
const char *const fun_ = (fun); \
|
||||||
if (fun_ == NULL) { \
|
if (fun_ == NULL) { \
|
||||||
internal_error("string(): NULL function name"); \
|
internal_error("string(): NULL function name"); \
|
||||||
ga_concat(gap, "function(NULL"); \
|
ga_concat(gap, "function(NULL"); \
|
||||||
@ -712,7 +712,7 @@ static inline int convert_to_json_string(garray_T *const gap, const char *const
|
|||||||
#undef TYPVAL_ENCODE_CONV_STRING
|
#undef TYPVAL_ENCODE_CONV_STRING
|
||||||
#define TYPVAL_ENCODE_CONV_STRING(tv, buf, len) \
|
#define TYPVAL_ENCODE_CONV_STRING(tv, buf, len) \
|
||||||
do { \
|
do { \
|
||||||
if (convert_to_json_string(gap, (const char *)(buf), (len)) != OK) { \
|
if (convert_to_json_string(gap, (buf), (len)) != OK) { \
|
||||||
return FAIL; \
|
return FAIL; \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
@ -319,7 +319,7 @@ static void api_wrapper(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
Object result = handler.fn(VIML_INTERNAL_CALL, args, &res_arena, &err);
|
Object result = handler.fn(VIML_INTERNAL_CALL, args, &res_arena, &err);
|
||||||
|
|
||||||
if (ERROR_SET(&err)) {
|
if (ERROR_SET(&err)) {
|
||||||
semsg_multiline((const char *)e_api_error, err.msg);
|
semsg_multiline(e_api_error, err.msg);
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1546,7 +1546,7 @@ static void f_eval(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
{
|
{
|
||||||
const char *s = tv_get_string_chk(&argvars[0]);
|
const char *s = tv_get_string_chk(&argvars[0]);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
s = (const char *)skipwhite(s);
|
s = skipwhite(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *const expr_start = s;
|
const char *const expr_start = s;
|
||||||
@ -1779,7 +1779,7 @@ static void f_expand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
if (rettv->v_type == VAR_LIST) {
|
if (rettv->v_type == VAR_LIST) {
|
||||||
tv_list_alloc_ret(rettv, (result != NULL));
|
tv_list_alloc_ret(rettv, (result != NULL));
|
||||||
if (result != NULL) {
|
if (result != NULL) {
|
||||||
tv_list_append_string(rettv->vval.v_list, (const char *)result, -1);
|
tv_list_append_string(rettv->vval.v_list, result, -1);
|
||||||
}
|
}
|
||||||
XFREE_CLEAR(result);
|
XFREE_CLEAR(result);
|
||||||
} else {
|
} else {
|
||||||
@ -1805,8 +1805,7 @@ static void f_expand(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
ExpandOne(&xpc, (char *)s, NULL, options, WILD_ALL_KEEP);
|
ExpandOne(&xpc, (char *)s, NULL, options, WILD_ALL_KEEP);
|
||||||
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
|
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
|
||||||
for (int i = 0; i < xpc.xp_numfiles; i++) {
|
for (int i = 0; i < xpc.xp_numfiles; i++) {
|
||||||
tv_list_append_string(rettv->vval.v_list,
|
tv_list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
|
||||||
(const char *)xpc.xp_files[i], -1);
|
|
||||||
}
|
}
|
||||||
ExpandCleanup(&xpc);
|
ExpandCleanup(&xpc);
|
||||||
}
|
}
|
||||||
@ -2134,7 +2133,7 @@ static void findfilendir(typval_T *argvars, typval_T *rettv, int find_what)
|
|||||||
first = false;
|
first = false;
|
||||||
|
|
||||||
if (fresult != NULL && rettv->v_type == VAR_LIST) {
|
if (fresult != NULL && rettv->v_type == VAR_LIST) {
|
||||||
tv_list_append_string(rettv->vval.v_list, (const char *)fresult, -1);
|
tv_list_append_string(rettv->vval.v_list, fresult, -1);
|
||||||
}
|
}
|
||||||
} while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL);
|
} while ((rettv->v_type == VAR_LIST || --count > 0) && fresult != NULL);
|
||||||
}
|
}
|
||||||
@ -3008,8 +3007,7 @@ static void f_glob(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
WILD_ALL_KEEP);
|
WILD_ALL_KEEP);
|
||||||
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
|
tv_list_alloc_ret(rettv, xpc.xp_numfiles);
|
||||||
for (int i = 0; i < xpc.xp_numfiles; i++) {
|
for (int i = 0; i < xpc.xp_numfiles; i++) {
|
||||||
tv_list_append_string(rettv->vval.v_list, (const char *)xpc.xp_files[i],
|
tv_list_append_string(rettv->vval.v_list, xpc.xp_files[i], -1);
|
||||||
-1);
|
|
||||||
}
|
}
|
||||||
ExpandCleanup(&xpc);
|
ExpandCleanup(&xpc);
|
||||||
}
|
}
|
||||||
@ -4050,7 +4048,7 @@ static dict_T *create_environment(const dictitem_T *job_env, const bool clear_en
|
|||||||
#ifdef MSWIN
|
#ifdef MSWIN
|
||||||
TV_DICT_ITER(job_env->di_tv.vval.v_dict, var, {
|
TV_DICT_ITER(job_env->di_tv.vval.v_dict, var, {
|
||||||
// Always use upper-case keys for Windows so we detect duplicate keys
|
// Always use upper-case keys for Windows so we detect duplicate keys
|
||||||
char *const key = strcase_save((const char *)var->di_key, true);
|
char *const key = strcase_save(var->di_key, true);
|
||||||
size_t len = strlen(key);
|
size_t len = strlen(key);
|
||||||
dictitem_T *dv = tv_dict_find(env, key, len);
|
dictitem_T *dv = tv_dict_find(env, key, len);
|
||||||
if (dv) {
|
if (dv) {
|
||||||
@ -4735,8 +4733,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
|
|||||||
if (regmatch.endp[i] == NULL) {
|
if (regmatch.endp[i] == NULL) {
|
||||||
tv_list_append_string(rettv->vval.v_list, NULL, 0);
|
tv_list_append_string(rettv->vval.v_list, NULL, 0);
|
||||||
} else {
|
} else {
|
||||||
tv_list_append_string(rettv->vval.v_list,
|
tv_list_append_string(rettv->vval.v_list, regmatch.startp[i],
|
||||||
(const char *)regmatch.startp[i],
|
|
||||||
(regmatch.endp[i] - regmatch.startp[i]));
|
(regmatch.endp[i] - regmatch.startp[i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4746,7 +4743,7 @@ static void find_some_match(typval_T *const argvars, typval_T *const rettv,
|
|||||||
if (l != NULL) {
|
if (l != NULL) {
|
||||||
tv_copy(TV_LIST_ITEM_TV(li), rettv);
|
tv_copy(TV_LIST_ITEM_TV(li), rettv);
|
||||||
} else {
|
} else {
|
||||||
rettv->vval.v_string = xmemdupz((const char *)regmatch.startp[0],
|
rettv->vval.v_string = xmemdupz(regmatch.startp[0],
|
||||||
(size_t)(regmatch.endp[0] -
|
(size_t)(regmatch.endp[0] -
|
||||||
regmatch.startp[0]));
|
regmatch.startp[0]));
|
||||||
}
|
}
|
||||||
@ -7910,14 +7907,14 @@ static void f_split(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
}
|
}
|
||||||
const char *end;
|
const char *end;
|
||||||
if (match) {
|
if (match) {
|
||||||
end = (const char *)regmatch.startp[0];
|
end = regmatch.startp[0];
|
||||||
} else {
|
} else {
|
||||||
end = str + strlen(str);
|
end = str + strlen(str);
|
||||||
}
|
}
|
||||||
if (keepempty || end > str || (tv_list_len(rettv->vval.v_list) > 0
|
if (keepempty || end > str || (tv_list_len(rettv->vval.v_list) > 0
|
||||||
&& *str != NUL
|
&& *str != NUL
|
||||||
&& match
|
&& match
|
||||||
&& end < (const char *)regmatch.endp[0])) {
|
&& end < regmatch.endp[0])) {
|
||||||
tv_list_append_string(rettv->vval.v_list, str, end - str);
|
tv_list_append_string(rettv->vval.v_list, str, end - str);
|
||||||
}
|
}
|
||||||
if (!match) {
|
if (!match) {
|
||||||
@ -7930,7 +7927,7 @@ static void f_split(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
// Don't get stuck at the same match.
|
// Don't get stuck at the same match.
|
||||||
col = utfc_ptr2len(regmatch.endp[0]);
|
col = utfc_ptr2len(regmatch.endp[0]);
|
||||||
}
|
}
|
||||||
str = (const char *)regmatch.endp[0];
|
str = regmatch.endp[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
vim_regfree(regmatch.regprog);
|
vim_regfree(regmatch.regprog);
|
||||||
|
@ -1091,7 +1091,7 @@ static int item_compare2(const void *s1, const void *s2, bool keep_zero)
|
|||||||
if (partial == NULL) {
|
if (partial == NULL) {
|
||||||
func_name = sortinfo->item_compare_func;
|
func_name = sortinfo->item_compare_func;
|
||||||
} else {
|
} else {
|
||||||
func_name = (const char *)partial_name(partial);
|
func_name = partial_name(partial);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy the values. This is needed to be able to set v_lock to VAR_FIXED
|
// Copy the values. This is needed to be able to set v_lock to VAR_FIXED
|
||||||
@ -1189,7 +1189,7 @@ static void do_sort_uniq(typval_T *argvars, typval_T *rettv, bool sort)
|
|||||||
if (argvars[1].v_type != VAR_UNKNOWN) {
|
if (argvars[1].v_type != VAR_UNKNOWN) {
|
||||||
// optional second argument: {func}
|
// optional second argument: {func}
|
||||||
if (argvars[1].v_type == VAR_FUNC) {
|
if (argvars[1].v_type == VAR_FUNC) {
|
||||||
info.item_compare_func = (const char *)argvars[1].vval.v_string;
|
info.item_compare_func = argvars[1].vval.v_string;
|
||||||
} else if (argvars[1].v_type == VAR_PARTIAL) {
|
} else if (argvars[1].v_type == VAR_PARTIAL) {
|
||||||
info.item_compare_partial = argvars[1].vval.v_partial;
|
info.item_compare_partial = argvars[1].vval.v_partial;
|
||||||
} else {
|
} else {
|
||||||
@ -1894,7 +1894,7 @@ void tv_dict_item_free(dictitem_T *const item)
|
|||||||
dictitem_T *tv_dict_item_copy(dictitem_T *const di)
|
dictitem_T *tv_dict_item_copy(dictitem_T *const di)
|
||||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
dictitem_T *const new_di = tv_dict_item_alloc((const char *)di->di_key);
|
dictitem_T *const new_di = tv_dict_item_alloc(di->di_key);
|
||||||
tv_copy(&di->di_tv, &new_di->di_tv);
|
tv_copy(&di->di_tv, &new_di->di_tv);
|
||||||
return new_di;
|
return new_di;
|
||||||
}
|
}
|
||||||
@ -2240,7 +2240,7 @@ int tv_dict_wrong_func_name(dict_T *d, typval_T *tv, const char *name)
|
|||||||
int tv_dict_add(dict_T *const d, dictitem_T *const item)
|
int tv_dict_add(dict_T *const d, dictitem_T *const item)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
if (tv_dict_wrong_func_name(d, &item->di_tv, (const char *)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, (char *)item->di_key);
|
||||||
@ -2477,9 +2477,9 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2, const char *const action
|
|||||||
|
|
||||||
HASHTAB_ITER(&d2->dv_hashtab, hi2, {
|
HASHTAB_ITER(&d2->dv_hashtab, hi2, {
|
||||||
dictitem_T *const di2 = TV_DICT_HI2DI(hi2);
|
dictitem_T *const di2 = TV_DICT_HI2DI(hi2);
|
||||||
dictitem_T *const di1 = tv_dict_find(d1, (const char *)di2->di_key, -1);
|
dictitem_T *const di1 = tv_dict_find(d1, di2->di_key, -1);
|
||||||
// Check the key to be valid when adding to any scope.
|
// Check the key to be valid when adding to any scope.
|
||||||
if (d1->dv_scope != VAR_NO_SCOPE && !valid_varname((const char *)di2->di_key)) {
|
if (d1->dv_scope != VAR_NO_SCOPE && !valid_varname(di2->di_key)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (di1 == NULL) {
|
if (di1 == NULL) {
|
||||||
@ -2489,14 +2489,14 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2, const char *const action
|
|||||||
dictitem_T *const new_di = di2;
|
dictitem_T *const new_di = di2;
|
||||||
if (tv_dict_add(d1, new_di) == OK) {
|
if (tv_dict_add(d1, new_di) == OK) {
|
||||||
hash_remove(&d2->dv_hashtab, hi2);
|
hash_remove(&d2->dv_hashtab, hi2);
|
||||||
tv_dict_watcher_notify(d1, (const char *)new_di->di_key, &new_di->di_tv, NULL);
|
tv_dict_watcher_notify(d1, new_di->di_key, &new_di->di_tv, NULL);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
dictitem_T *const new_di = tv_dict_item_copy(di2);
|
dictitem_T *const new_di = tv_dict_item_copy(di2);
|
||||||
if (tv_dict_add(d1, new_di) == FAIL) {
|
if (tv_dict_add(d1, new_di) == FAIL) {
|
||||||
tv_dict_item_free(new_di);
|
tv_dict_item_free(new_di);
|
||||||
} else if (watched) {
|
} else if (watched) {
|
||||||
tv_dict_watcher_notify(d1, (const char *)new_di->di_key, &new_di->di_tv, NULL);
|
tv_dict_watcher_notify(d1, new_di->di_key, &new_di->di_tv, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (*action == 'e') {
|
} else if (*action == 'e') {
|
||||||
@ -2510,7 +2510,7 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2, const char *const action
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// Disallow replacing a builtin function.
|
// Disallow replacing a builtin function.
|
||||||
if (tv_dict_wrong_func_name(d1, &di2->di_tv, (const char *)di2->di_key)) {
|
if (tv_dict_wrong_func_name(d1, &di2->di_tv, di2->di_key)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2522,8 +2522,7 @@ void tv_dict_extend(dict_T *const d1, dict_T *const d2, const char *const action
|
|||||||
tv_copy(&di2->di_tv, &di1->di_tv);
|
tv_copy(&di2->di_tv, &di1->di_tv);
|
||||||
|
|
||||||
if (watched) {
|
if (watched) {
|
||||||
tv_dict_watcher_notify(d1, (const char *)di1->di_key, &di1->di_tv,
|
tv_dict_watcher_notify(d1, di1->di_key, &di1->di_tv, &oldtv);
|
||||||
&oldtv);
|
|
||||||
tv_clear(&oldtv);
|
tv_clear(&oldtv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2558,7 +2557,7 @@ bool tv_dict_equal(dict_T *const d1, dict_T *const d2, const bool ic, const bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
TV_DICT_ITER(d1, di1, {
|
TV_DICT_ITER(d1, di1, {
|
||||||
dictitem_T *const di2 = tv_dict_find(d2, (const char *)di1->di_key, -1);
|
dictitem_T *const di2 = tv_dict_find(d2, di1->di_key, -1);
|
||||||
if (di2 == NULL) {
|
if (di2 == NULL) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -2597,12 +2596,12 @@ dict_T *tv_dict_copy(const vimconv_T *const conv, dict_T *const orig, const bool
|
|||||||
}
|
}
|
||||||
dictitem_T *new_di;
|
dictitem_T *new_di;
|
||||||
if (conv == NULL || conv->vc_type == CONV_NONE) {
|
if (conv == NULL || conv->vc_type == CONV_NONE) {
|
||||||
new_di = tv_dict_item_alloc((const char *)di->di_key);
|
new_di = tv_dict_item_alloc(di->di_key);
|
||||||
} else {
|
} else {
|
||||||
size_t len = strlen((char *)di->di_key);
|
size_t len = strlen(di->di_key);
|
||||||
char *const key = (char *)string_convert(conv, (char *)di->di_key, &len);
|
char *const key = string_convert(conv, di->di_key, &len);
|
||||||
if (key == NULL) {
|
if (key == NULL) {
|
||||||
new_di = tv_dict_item_alloc_len((const char *)di->di_key, len);
|
new_di = tv_dict_item_alloc_len(di->di_key, len);
|
||||||
} else {
|
} else {
|
||||||
new_di = tv_dict_item_alloc_len(key, len);
|
new_di = tv_dict_item_alloc_len(key, len);
|
||||||
xfree(key);
|
xfree(key);
|
||||||
@ -2960,7 +2959,7 @@ static void tv_dict_list(typval_T *const tv, typval_T *const rettv, const DictLi
|
|||||||
tv_list_append_owned_tv(sub_l, (typval_T) {
|
tv_list_append_owned_tv(sub_l, (typval_T) {
|
||||||
.v_type = VAR_STRING,
|
.v_type = VAR_STRING,
|
||||||
.v_lock = VAR_UNLOCKED,
|
.v_lock = VAR_UNLOCKED,
|
||||||
.vval.v_string = xstrdup((const char *)di->di_key),
|
.vval.v_string = xstrdup(di->di_key),
|
||||||
});
|
});
|
||||||
|
|
||||||
tv_list_append_tv(sub_l, &di->di_tv);
|
tv_list_append_tv(sub_l, &di->di_tv);
|
||||||
@ -3132,7 +3131,7 @@ static inline int _nothing_conv_func_start(typval_T *const tv, char *const fun)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
func_unref(fun);
|
func_unref(fun);
|
||||||
if ((const char *)fun != tv_empty_string) {
|
if (fun != tv_empty_string) {
|
||||||
xfree(fun);
|
xfree(fun);
|
||||||
}
|
}
|
||||||
tv->vval.v_string = NULL;
|
tv->vval.v_string = NULL;
|
||||||
@ -3805,7 +3804,7 @@ static const char *const str_errors[] = {
|
|||||||
[VAR_FUNC]= N_(FUNC_ERROR),
|
[VAR_FUNC]= N_(FUNC_ERROR),
|
||||||
[VAR_LIST]= N_("E730: using List as a String"),
|
[VAR_LIST]= N_("E730: using List as a String"),
|
||||||
[VAR_DICT]= N_("E731: using Dictionary as a String"),
|
[VAR_DICT]= N_("E731: using Dictionary as a String"),
|
||||||
[VAR_FLOAT]= ((const char *)e_float_as_string),
|
[VAR_FLOAT]= e_float_as_string,
|
||||||
[VAR_BLOB]= N_("E976: using Blob as a String"),
|
[VAR_BLOB]= N_("E976: using Blob as a String"),
|
||||||
[VAR_UNKNOWN]= N_("E908: using an invalid value as a String"),
|
[VAR_UNKNOWN]= N_("E908: using an invalid value as a String"),
|
||||||
};
|
};
|
||||||
@ -4116,7 +4115,7 @@ const char *tv_get_string_buf_chk(const typval_T *const tv, char *const buf)
|
|||||||
return buf;
|
return buf;
|
||||||
case VAR_STRING:
|
case VAR_STRING:
|
||||||
if (tv->vval.v_string != NULL) {
|
if (tv->vval.v_string != NULL) {
|
||||||
return (const char *)tv->vval.v_string;
|
return tv->vval.v_string;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
case VAR_BOOL:
|
case VAR_BOOL:
|
||||||
|
@ -1575,7 +1575,7 @@ int call_func(const char *funcname, int len, typval_T *rettv, int argcount_in, t
|
|||||||
XFREE_CLEAR(name);
|
XFREE_CLEAR(name);
|
||||||
funcname = "v:lua";
|
funcname = "v:lua";
|
||||||
}
|
}
|
||||||
} else if (fp != NULL || !builtin_function((const char *)rfname, -1)) {
|
} else if (fp != NULL || !builtin_function(rfname, -1)) {
|
||||||
// User defined function.
|
// User defined function.
|
||||||
if (fp == NULL) {
|
if (fp == NULL) {
|
||||||
fp = find_func(rfname);
|
fp = find_func(rfname);
|
||||||
@ -1589,8 +1589,7 @@ int call_func(const char *funcname, int len, typval_T *rettv, int argcount_in, t
|
|||||||
fp = find_func(rfname);
|
fp = find_func(rfname);
|
||||||
}
|
}
|
||||||
// Try loading a package.
|
// Try loading a package.
|
||||||
if (fp == NULL && script_autoload((const char *)rfname, strlen(rfname),
|
if (fp == NULL && script_autoload(rfname, strlen(rfname), true) && !aborting()) {
|
||||||
true) && !aborting()) {
|
|
||||||
// Loaded a package, search for the function again.
|
// Loaded a package, search for the function again.
|
||||||
fp = find_func(rfname);
|
fp = find_func(rfname);
|
||||||
}
|
}
|
||||||
@ -1666,7 +1665,7 @@ static void list_func_head(ufunc_T *fp, int indent, bool force)
|
|||||||
}
|
}
|
||||||
msg_puts(force ? "function! " : "function ");
|
msg_puts(force ? "function! " : "function ");
|
||||||
if (fp->uf_name_exp != NULL) {
|
if (fp->uf_name_exp != NULL) {
|
||||||
msg_puts((const char *)fp->uf_name_exp);
|
msg_puts(fp->uf_name_exp);
|
||||||
} else {
|
} else {
|
||||||
msg_puts(fp->uf_name);
|
msg_puts(fp->uf_name);
|
||||||
}
|
}
|
||||||
@ -1676,7 +1675,7 @@ static void list_func_head(ufunc_T *fp, int indent, bool force)
|
|||||||
if (j) {
|
if (j) {
|
||||||
msg_puts(", ");
|
msg_puts(", ");
|
||||||
}
|
}
|
||||||
msg_puts((const char *)FUNCARG(fp, j));
|
msg_puts(FUNCARG(fp, j));
|
||||||
if (j >= fp->uf_args.ga_len - fp->uf_def_args.ga_len) {
|
if (j >= fp->uf_args.ga_len - fp->uf_def_args.ga_len) {
|
||||||
msg_puts(" = ");
|
msg_puts(" = ");
|
||||||
msg_puts(((char **)(fp->uf_def_args.ga_data))
|
msg_puts(((char **)(fp->uf_def_args.ga_data))
|
||||||
@ -1828,7 +1827,7 @@ char *trans_function_name(char **pp, bool skip, int flags, funcdict_T *fdp, part
|
|||||||
len = (int)strlen(lv.ll_exp_name);
|
len = (int)strlen(lv.ll_exp_name);
|
||||||
name = deref_func_name(lv.ll_exp_name, &len, partial,
|
name = deref_func_name(lv.ll_exp_name, &len, partial,
|
||||||
flags & TFN_NO_AUTOLOAD);
|
flags & TFN_NO_AUTOLOAD);
|
||||||
if ((const char *)name == lv.ll_exp_name) {
|
if (name == lv.ll_exp_name) {
|
||||||
name = NULL;
|
name = NULL;
|
||||||
}
|
}
|
||||||
} else if (!(flags & TFN_NO_DEREF)) {
|
} else if (!(flags & TFN_NO_DEREF)) {
|
||||||
@ -1881,8 +1880,7 @@ char *trans_function_name(char **pp, bool skip, int flags, funcdict_T *fdp, part
|
|||||||
lead = 0; // do nothing
|
lead = 0; // do nothing
|
||||||
} else if (lead > 0) {
|
} else if (lead > 0) {
|
||||||
lead = 3;
|
lead = 3;
|
||||||
if ((lv.ll_exp_name != NULL && eval_fname_sid(lv.ll_exp_name))
|
if ((lv.ll_exp_name != NULL && eval_fname_sid(lv.ll_exp_name)) || eval_fname_sid(*pp)) {
|
||||||
|| eval_fname_sid((const char *)(*pp))) {
|
|
||||||
// It's "s:" or "<SID>".
|
// It's "s:" or "<SID>".
|
||||||
if (current_sctx.sc_sid <= 0) {
|
if (current_sctx.sc_sid <= 0) {
|
||||||
emsg(_(e_usingsid));
|
emsg(_(e_usingsid));
|
||||||
@ -2209,7 +2207,7 @@ void ex_function(exarg_T *eap)
|
|||||||
|
|
||||||
if (KeyTyped && ui_has(kUICmdline)) {
|
if (KeyTyped && ui_has(kUICmdline)) {
|
||||||
show_block = true;
|
show_block = true;
|
||||||
ui_ext_cmdline_block_append(0, (const char *)eap->cmd);
|
ui_ext_cmdline_block_append(0, eap->cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
// find extra arguments "range", "dict", "abort" and "closure"
|
// find extra arguments "range", "dict", "abort" and "closure"
|
||||||
@ -2308,7 +2306,7 @@ void ex_function(exarg_T *eap)
|
|||||||
}
|
}
|
||||||
if (show_block) {
|
if (show_block) {
|
||||||
assert(indent >= 0);
|
assert(indent >= 0);
|
||||||
ui_ext_cmdline_block_append((size_t)indent, (const char *)theline);
|
ui_ext_cmdline_block_append((size_t)indent, theline);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Detect line continuation: SOURCING_LNUM increased more than one.
|
// Detect line continuation: SOURCING_LNUM increased more than one.
|
||||||
@ -2390,7 +2388,7 @@ void ex_function(exarg_T *eap)
|
|||||||
if (*p == '!') {
|
if (*p == '!') {
|
||||||
p = skipwhite(p + 1);
|
p = skipwhite(p + 1);
|
||||||
}
|
}
|
||||||
p += eval_fname_script((const char *)p);
|
p += eval_fname_script(p);
|
||||||
xfree(trans_function_name(&p, true, 0, NULL, NULL));
|
xfree(trans_function_name(&p, true, 0, NULL, NULL));
|
||||||
if (*skipwhite(p) == '(') {
|
if (*skipwhite(p) == '(') {
|
||||||
if (nesting == MAX_FUNC_NESTING - 1) {
|
if (nesting == MAX_FUNC_NESTING - 1) {
|
||||||
@ -2501,7 +2499,7 @@ void ex_function(exarg_T *eap)
|
|||||||
|
|
||||||
// If there are no errors, add the function
|
// If there are no errors, add the function
|
||||||
if (fudi.fd_dict == NULL) {
|
if (fudi.fd_dict == NULL) {
|
||||||
v = find_var((const char *)name, strlen(name), &ht, false);
|
v = find_var(name, strlen(name), &ht, false);
|
||||||
if (v != NULL && v->di_tv.v_type == VAR_FUNC) {
|
if (v != NULL && v->di_tv.v_type == VAR_FUNC) {
|
||||||
emsg_funcname(N_("E707: Function name conflicts with variable: %s"), name);
|
emsg_funcname(N_("E707: Function name conflicts with variable: %s"), name);
|
||||||
goto erret;
|
goto erret;
|
||||||
@ -2548,13 +2546,11 @@ void ex_function(exarg_T *eap)
|
|||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
if (fudi.fd_di == NULL) {
|
if (fudi.fd_di == NULL) {
|
||||||
if (value_check_lock(fudi.fd_dict->dv_lock, (const char *)eap->arg,
|
if (value_check_lock(fudi.fd_dict->dv_lock, eap->arg, TV_CSTRING)) {
|
||||||
TV_CSTRING)) {
|
|
||||||
// Can't add a function to a locked dictionary
|
// Can't add a function to a locked dictionary
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
} else if (value_check_lock(fudi.fd_di->di_tv.v_lock, (const char *)eap->arg,
|
} else if (value_check_lock(fudi.fd_di->di_tv.v_lock, eap->arg, TV_CSTRING)) {
|
||||||
TV_CSTRING)) {
|
|
||||||
// Can't change an existing function if it is locked
|
// Can't change an existing function if it is locked
|
||||||
goto erret;
|
goto erret;
|
||||||
}
|
}
|
||||||
@ -2595,7 +2591,7 @@ void ex_function(exarg_T *eap)
|
|||||||
if (fudi.fd_dict != NULL) {
|
if (fudi.fd_dict != NULL) {
|
||||||
if (fudi.fd_di == NULL) {
|
if (fudi.fd_di == NULL) {
|
||||||
// Add new dict entry
|
// Add new dict entry
|
||||||
fudi.fd_di = tv_dict_item_alloc((const char *)fudi.fd_newkey);
|
fudi.fd_di = tv_dict_item_alloc(fudi.fd_newkey);
|
||||||
if (tv_dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) {
|
if (tv_dict_add(fudi.fd_dict, fudi.fd_di) == FAIL) {
|
||||||
xfree(fudi.fd_di);
|
xfree(fudi.fd_di);
|
||||||
xfree(fp);
|
xfree(fp);
|
||||||
|
@ -215,7 +215,7 @@ static void ex_let_const(exarg_T *eap, const bool is_const)
|
|||||||
emsg(_(e_invarg));
|
emsg(_(e_invarg));
|
||||||
} else if (!ends_excmd(*arg)) {
|
} else if (!ends_excmd(*arg)) {
|
||||||
// ":let var1 var2"
|
// ":let var1 var2"
|
||||||
arg = (char *)list_arg_vars(eap, (const char *)arg, &first);
|
arg = (char *)list_arg_vars(eap, arg, &first);
|
||||||
} else if (!eap->skip) {
|
} else if (!eap->skip) {
|
||||||
// ":let"
|
// ":let"
|
||||||
list_glob_vars(&first);
|
list_glob_vars(&first);
|
||||||
@ -551,7 +551,7 @@ static const char *list_arg_vars(exarg_T *eap, const char *arg, int *first)
|
|||||||
xfree(tofree);
|
xfree(tofree);
|
||||||
}
|
}
|
||||||
|
|
||||||
arg = (const char *)skipwhite(arg);
|
arg = skipwhite(arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
return arg;
|
return arg;
|
||||||
@ -601,7 +601,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
|
|||||||
char *s = vim_getenv(name);
|
char *s = vim_getenv(name);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
tofree = concat_str(s, p);
|
tofree = concat_str(s, p);
|
||||||
p = (const char *)tofree;
|
p = tofree;
|
||||||
xfree(s);
|
xfree(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -725,7 +725,7 @@ static char *ex_let_one(char *arg, typval_T *const tv, const bool copy, const bo
|
|||||||
char *s = get_reg_contents(*arg == '@' ? '"' : *arg, kGRegExprSrc);
|
char *s = get_reg_contents(*arg == '@' ? '"' : *arg, kGRegExprSrc);
|
||||||
if (s != NULL) {
|
if (s != NULL) {
|
||||||
ptofree = concat_str(s, p);
|
ptofree = concat_str(s, p);
|
||||||
p = (const char *)ptofree;
|
p = ptofree;
|
||||||
xfree(s);
|
xfree(s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -798,7 +798,7 @@ static void ex_unletlock(exarg_T *eap, char *argstart, int deep, ex_unletlock_ca
|
|||||||
|
|
||||||
do {
|
do {
|
||||||
if (*arg == '$') {
|
if (*arg == '$') {
|
||||||
lv.ll_name = (const char *)arg;
|
lv.ll_name = arg;
|
||||||
lv.ll_tv = NULL;
|
lv.ll_tv = NULL;
|
||||||
arg++;
|
arg++;
|
||||||
if (get_env_len((const char **)&arg) == 0) {
|
if (get_env_len((const char **)&arg) == 0) {
|
||||||
@ -1169,7 +1169,7 @@ void delete_var(hashtab_T *ht, hashitem_T *hi)
|
|||||||
static void list_one_var(dictitem_T *v, const char *prefix, int *first)
|
static void list_one_var(dictitem_T *v, const char *prefix, int *first)
|
||||||
{
|
{
|
||||||
char *const s = encode_tv2echo(&v->di_tv, NULL);
|
char *const s = encode_tv2echo(&v->di_tv, NULL);
|
||||||
list_one_var_a(prefix, (const char *)v->di_key, (ptrdiff_t)strlen((char *)v->di_key),
|
list_one_var_a(prefix, v->di_key, (ptrdiff_t)strlen((char *)v->di_key),
|
||||||
v->di_tv.v_type, (s == NULL ? "" : s), first);
|
v->di_tv.v_type, (s == NULL ? "" : s), first);
|
||||||
xfree(s);
|
xfree(s);
|
||||||
}
|
}
|
||||||
|
@ -1388,7 +1388,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
|
|||||||
if (is_pwsh) {
|
if (is_pwsh) {
|
||||||
if (itmp != NULL) {
|
if (itmp != NULL) {
|
||||||
xstrlcpy(buf, "& { Get-Content ", len - 1); // FIXME: should we add "-Encoding utf8"?
|
xstrlcpy(buf, "& { Get-Content ", len - 1); // FIXME: should we add "-Encoding utf8"?
|
||||||
xstrlcat(buf, (const char *)itmp, len - 1);
|
xstrlcat(buf, itmp, len - 1);
|
||||||
xstrlcat(buf, " | & ", len - 1); // FIXME: add `&` ourself or leave to user?
|
xstrlcat(buf, " | & ", len - 1); // FIXME: add `&` ourself or leave to user?
|
||||||
xstrlcat(buf, cmd, len - 1);
|
xstrlcat(buf, cmd, len - 1);
|
||||||
xstrlcat(buf, " }", len - 1);
|
xstrlcat(buf, " }", len - 1);
|
||||||
@ -1409,7 +1409,7 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
|
|||||||
|
|
||||||
if (itmp != NULL) {
|
if (itmp != NULL) {
|
||||||
xstrlcat(buf, " < ", len - 1);
|
xstrlcat(buf, " < ", len - 1);
|
||||||
xstrlcat(buf, (const char *)itmp, len - 1);
|
xstrlcat(buf, itmp, len - 1);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
// For shells that don't understand braces around commands, at least allow
|
// For shells that don't understand braces around commands, at least allow
|
||||||
@ -1426,9 +1426,9 @@ char *make_filter_cmd(char *cmd, char *itmp, char *otmp)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
xstrlcat(buf, " < ", len);
|
xstrlcat(buf, " < ", len);
|
||||||
xstrlcat(buf, (const char *)itmp, len);
|
xstrlcat(buf, itmp, len);
|
||||||
if (*p_shq == NUL) {
|
if (*p_shq == NUL) {
|
||||||
const char *const p = find_pipe((const char *)cmd);
|
const char *const p = find_pipe(cmd);
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
xstrlcat(buf, " ", len - 1); // Insert a space before the '|' for DOS
|
xstrlcat(buf, " ", len - 1); // Insert a space before the '|' for DOS
|
||||||
xstrlcat(buf, p, len - 1);
|
xstrlcat(buf, p, len - 1);
|
||||||
|
@ -814,7 +814,7 @@ static void script_host_do_range(char *name, exarg_T *eap)
|
|||||||
list_T *args = tv_list_alloc(3);
|
list_T *args = tv_list_alloc(3);
|
||||||
tv_list_append_number(args, (int)eap->line1);
|
tv_list_append_number(args, (int)eap->line1);
|
||||||
tv_list_append_number(args, (int)eap->line2);
|
tv_list_append_number(args, (int)eap->line2);
|
||||||
tv_list_append_string(args, (const char *)eap->arg, -1);
|
tv_list_append_string(args, eap->arg, -1);
|
||||||
(void)eval_call_provider(name, "do_range", args, true);
|
(void)eval_call_provider(name, "do_range", args, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4452,7 +4452,7 @@ static void ex_highlight(exarg_T *eap)
|
|||||||
if (*eap->arg == NUL && eap->cmd[2] == '!') {
|
if (*eap->arg == NUL && eap->cmd[2] == '!') {
|
||||||
msg(_("Greetings, Vim user!"));
|
msg(_("Greetings, Vim user!"));
|
||||||
}
|
}
|
||||||
do_highlight((const char *)eap->arg, eap->forceit, false);
|
do_highlight(eap->arg, eap->forceit, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Call this function if we thought we were going to exit, but we won't
|
/// Call this function if we thought we were going to exit, but we won't
|
||||||
@ -5211,7 +5211,7 @@ void do_exedit(exarg_T *eap, win_T *old_curwin)
|
|||||||
int ms = msg_scroll;
|
int ms = msg_scroll;
|
||||||
|
|
||||||
if (eap->nextcmd != NULL) {
|
if (eap->nextcmd != NULL) {
|
||||||
stuffReadbuff((const char *)eap->nextcmd);
|
stuffReadbuff(eap->nextcmd);
|
||||||
eap->nextcmd = NULL;
|
eap->nextcmd = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1125,7 +1125,7 @@ void ex_endwhile(exarg_T *eap)
|
|||||||
/// Handle ":throw expr"
|
/// Handle ":throw expr"
|
||||||
void ex_throw(exarg_T *eap)
|
void ex_throw(exarg_T *eap)
|
||||||
{
|
{
|
||||||
const char *arg = (const char *)eap->arg;
|
const char *arg = eap->arg;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
if (*arg != NUL && *arg != '|' && *arg != '\n') {
|
if (*arg != NUL && *arg != '|' && *arg != '\n') {
|
||||||
|
@ -2947,7 +2947,7 @@ static void color_expr_cmdline(const CmdlineInfo *const colored_ccline,
|
|||||||
{
|
{
|
||||||
ParserLine parser_lines[] = {
|
ParserLine parser_lines[] = {
|
||||||
{
|
{
|
||||||
.data = (const char *)colored_ccline->cmdbuff,
|
.data = colored_ccline->cmdbuff,
|
||||||
.size = strlen(colored_ccline->cmdbuff),
|
.size = strlen(colored_ccline->cmdbuff),
|
||||||
.allocated = false,
|
.allocated = false,
|
||||||
},
|
},
|
||||||
@ -3051,7 +3051,7 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
|
|||||||
bool can_free_cb = false;
|
bool can_free_cb = false;
|
||||||
TryState tstate;
|
TryState tstate;
|
||||||
Error err = ERROR_INIT;
|
Error err = ERROR_INIT;
|
||||||
const char *err_errmsg = (const char *)e_intern2;
|
const char *err_errmsg = e_intern2;
|
||||||
bool dgc_ret = true;
|
bool dgc_ret = true;
|
||||||
bool tl_ret = true;
|
bool tl_ret = true;
|
||||||
|
|
||||||
@ -3084,8 +3084,7 @@ static bool color_cmdline(CmdlineInfo *colored_ccline)
|
|||||||
}
|
}
|
||||||
if (colored_ccline->cmdbuff[colored_ccline->cmdlen] != NUL) {
|
if (colored_ccline->cmdbuff[colored_ccline->cmdlen] != NUL) {
|
||||||
arg_allocated = true;
|
arg_allocated = true;
|
||||||
arg.vval.v_string = xmemdupz((const char *)colored_ccline->cmdbuff,
|
arg.vval.v_string = xmemdupz(colored_ccline->cmdbuff, (size_t)colored_ccline->cmdlen);
|
||||||
(size_t)colored_ccline->cmdlen);
|
|
||||||
}
|
}
|
||||||
// msg_start() called by e.g. :echo may shift command-line to the first column
|
// msg_start() called by e.g. :echo may shift command-line to the first column
|
||||||
// even though msg_silent is here. Two ways to workaround this problem without
|
// even though msg_silent is here. Two ways to workaround this problem without
|
||||||
@ -3204,8 +3203,7 @@ color_cmdline_end:
|
|||||||
if (arg_allocated) {
|
if (arg_allocated) {
|
||||||
ccline_colors->cmdbuff = arg.vval.v_string;
|
ccline_colors->cmdbuff = arg.vval.v_string;
|
||||||
} else {
|
} else {
|
||||||
ccline_colors->cmdbuff = xmemdupz((const char *)colored_ccline->cmdbuff,
|
ccline_colors->cmdbuff = xmemdupz(colored_ccline->cmdbuff, (size_t)colored_ccline->cmdlen);
|
||||||
(size_t)colored_ccline->cmdlen);
|
|
||||||
}
|
}
|
||||||
tv_clear(&tv);
|
tv_clear(&tv);
|
||||||
return ret;
|
return ret;
|
||||||
@ -4558,7 +4556,7 @@ bool is_in_cmdwin(void)
|
|||||||
char *script_get(exarg_T *const eap, size_t *const lenp)
|
char *script_get(exarg_T *const eap, size_t *const lenp)
|
||||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
||||||
{
|
{
|
||||||
const char *const cmd = (const char *)eap->arg;
|
const char *const cmd = eap->arg;
|
||||||
|
|
||||||
if (cmd[0] != '<' || cmd[1] != '<' || eap->getline == NULL) {
|
if (cmd[0] != '<' || cmd[1] != '<' || eap->getline == NULL) {
|
||||||
*lenp = strlen(eap->arg);
|
*lenp = strlen(eap->arg);
|
||||||
@ -4570,7 +4568,7 @@ char *script_get(exarg_T *const eap, size_t *const lenp)
|
|||||||
ga_init(&ga, 1, 0x400);
|
ga_init(&ga, 1, 0x400);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *const end_pattern = (cmd[2] != NUL ? (const char *)skipwhite(cmd + 2) : ".");
|
const char *const end_pattern = (cmd[2] != NUL ? skipwhite(cmd + 2) : ".");
|
||||||
for (;;) {
|
for (;;) {
|
||||||
char *const theline = eap->getline(eap->cstack->cs_looplevel > 0 ? -1 : NUL, eap->cookie, 0,
|
char *const theline = eap->getline(eap->cstack->cs_looplevel > 0 ? -1 : NUL, eap->cookie, 0,
|
||||||
true);
|
true);
|
||||||
|
@ -1341,7 +1341,7 @@ char *find_file_in_path_option(char *ptr, size_t len, int options, int first, ch
|
|||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
int rel_to_curdir;
|
int rel_to_curdir;
|
||||||
|
|
||||||
if (rel_fname != NULL && path_with_url((const char *)rel_fname)) {
|
if (rel_fname != NULL && path_with_url(rel_fname)) {
|
||||||
// Do not attempt to search "relative" to a URL. #6009
|
// Do not attempt to search "relative" to a URL. #6009
|
||||||
rel_fname = NULL;
|
rel_fname = NULL;
|
||||||
}
|
}
|
||||||
|
@ -145,7 +145,7 @@ void filemess(buf_T *buf, char *name, char *s, int attr)
|
|||||||
if (msg_silent != 0) {
|
if (msg_silent != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
add_quoted_fname(IObuff, IOSIZE - 100, buf, (const char *)name);
|
add_quoted_fname(IObuff, IOSIZE - 100, buf, name);
|
||||||
// Avoid an over-long translation to cause trouble.
|
// Avoid an over-long translation to cause trouble.
|
||||||
xstrlcat(IObuff, s, IOSIZE);
|
xstrlcat(IObuff, s, IOSIZE);
|
||||||
// For the first message may have to start a new line.
|
// For the first message may have to start a new line.
|
||||||
@ -576,7 +576,7 @@ int readfile(char *fname, char *sfname, linenr_T from, linenr_T lines_to_skip,
|
|||||||
// Set swap file protection bits after creating it.
|
// Set swap file protection bits after creating it.
|
||||||
if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
|
if (swap_mode > 0 && curbuf->b_ml.ml_mfp != NULL
|
||||||
&& curbuf->b_ml.ml_mfp->mf_fname != NULL) {
|
&& curbuf->b_ml.ml_mfp->mf_fname != NULL) {
|
||||||
const char *swap_fname = (const char *)curbuf->b_ml.ml_mfp->mf_fname;
|
const char *swap_fname = curbuf->b_ml.ml_mfp->mf_fname;
|
||||||
|
|
||||||
// If the group-read bit is set but not the world-read bit, then
|
// If the group-read bit is set but not the world-read bit, then
|
||||||
// the group must be equal to the group of the original file. If
|
// the group must be equal to the group of the original file. If
|
||||||
@ -1732,7 +1732,7 @@ failed:
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!filtering && !(flags & READ_DUMMY) && !silent) {
|
if (!filtering && !(flags & READ_DUMMY) && !silent) {
|
||||||
add_quoted_fname(IObuff, IOSIZE, curbuf, (const char *)sfname);
|
add_quoted_fname(IObuff, IOSIZE, curbuf, sfname);
|
||||||
c = false;
|
c = false;
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
@ -2372,7 +2372,7 @@ static int get_fileinfo_os(char *fname, FileInfo *file_info_old, bool overwritin
|
|||||||
*newfile = true;
|
*newfile = true;
|
||||||
*perm = -1;
|
*perm = -1;
|
||||||
} else {
|
} else {
|
||||||
*perm = os_getperm((const char *)fname);
|
*perm = os_getperm(fname);
|
||||||
if (*perm < 0) {
|
if (*perm < 0) {
|
||||||
*newfile = true;
|
*newfile = true;
|
||||||
} else if (os_isdir(fname)) {
|
} else if (os_isdir(fname)) {
|
||||||
@ -2611,7 +2611,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
|
|||||||
|
|
||||||
// set file protection same as original file, but
|
// set file protection same as original file, but
|
||||||
// strip s-bit.
|
// strip s-bit.
|
||||||
(void)os_setperm((const char *)(*backupp), perm & 0777);
|
(void)os_setperm(*backupp, perm & 0777);
|
||||||
|
|
||||||
#ifdef UNIX
|
#ifdef UNIX
|
||||||
//
|
//
|
||||||
@ -2621,8 +2621,7 @@ static int buf_write_make_backup(char *fname, bool append, FileInfo *file_info_o
|
|||||||
//
|
//
|
||||||
if (file_info_new.stat.st_gid != file_info_old->stat.st_gid
|
if (file_info_new.stat.st_gid != file_info_old->stat.st_gid
|
||||||
&& os_chown(*backupp, (uv_uid_t)-1, (uv_gid_t)file_info_old->stat.st_gid) != 0) {
|
&& os_chown(*backupp, (uv_uid_t)-1, (uv_gid_t)file_info_old->stat.st_gid) != 0) {
|
||||||
os_setperm((const char *)(*backupp),
|
os_setperm(*backupp, ((int)perm & 0707) | (((int)perm & 07) << 3));
|
||||||
((int)perm & 0707) | (((int)perm & 07) << 3));
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2960,7 +2959,7 @@ int buf_write(buf_T *buf, char *fname, char *sfname, linenr_T start, linenr_T en
|
|||||||
&& file_info_old.stat.st_uid == getuid()
|
&& file_info_old.stat.st_uid == getuid()
|
||||||
&& vim_strchr(p_cpo, CPO_FWRITE) == NULL) {
|
&& vim_strchr(p_cpo, CPO_FWRITE) == NULL) {
|
||||||
perm |= 0200;
|
perm |= 0200;
|
||||||
(void)os_setperm((const char *)fname, (int)perm);
|
(void)os_setperm(fname, (int)perm);
|
||||||
made_writable = true;
|
made_writable = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -3378,7 +3377,7 @@ restore_backup:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (perm >= 0) { // Set perm. of new file same as old file.
|
if (perm >= 0) { // Set perm. of new file same as old file.
|
||||||
(void)os_setperm((const char *)wfname, (int)perm);
|
(void)os_setperm(wfname, (int)perm);
|
||||||
}
|
}
|
||||||
// Probably need to set the ACL before changing the user (can't set the
|
// Probably need to set the ACL before changing the user (can't set the
|
||||||
// ACL on a file the user doesn't own).
|
// ACL on a file the user doesn't own).
|
||||||
@ -3459,7 +3458,7 @@ restore_backup:
|
|||||||
fname = sfname; // use shortname now, for the messages
|
fname = sfname; // use shortname now, for the messages
|
||||||
#endif
|
#endif
|
||||||
if (!filtering) {
|
if (!filtering) {
|
||||||
add_quoted_fname(IObuff, IOSIZE, buf, (const char *)fname);
|
add_quoted_fname(IObuff, IOSIZE, buf, fname);
|
||||||
bool insert_space = false;
|
bool insert_space = false;
|
||||||
if (write_info.bw_conv_error) {
|
if (write_info.bw_conv_error) {
|
||||||
STRCAT(IObuff, _(" CONVERSION ERROR"));
|
STRCAT(IObuff, _(" CONVERSION ERROR"));
|
||||||
@ -3563,7 +3562,7 @@ restore_backup:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (org != NULL) {
|
if (org != NULL) {
|
||||||
os_setperm(org, os_getperm((const char *)fname) & 0777);
|
os_setperm(org, os_getperm(fname) & 0777);
|
||||||
xfree(org);
|
xfree(org);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3600,9 +3599,9 @@ nofail:
|
|||||||
if (err.msg != NULL) {
|
if (err.msg != NULL) {
|
||||||
// - 100 to save some space for further error message
|
// - 100 to save some space for further error message
|
||||||
#ifndef UNIX
|
#ifndef UNIX
|
||||||
add_quoted_fname(IObuff, IOSIZE - 100, buf, (const char *)sfname);
|
add_quoted_fname(IObuff, IOSIZE - 100, buf, sfname);
|
||||||
#else
|
#else
|
||||||
add_quoted_fname(IObuff, IOSIZE - 100, buf, (const char *)fname);
|
add_quoted_fname(IObuff, IOSIZE - 100, buf, fname);
|
||||||
#endif
|
#endif
|
||||||
emit_err(&err);
|
emit_err(&err);
|
||||||
|
|
||||||
@ -5295,7 +5294,7 @@ int delete_recursive(const char *name)
|
|||||||
if (readdir_core(&ga, exp, NULL, NULL) == OK) {
|
if (readdir_core(&ga, exp, NULL, NULL) == OK) {
|
||||||
for (int i = 0; i < ga.ga_len; i++) {
|
for (int i = 0; i < ga.ga_len; i++) {
|
||||||
vim_snprintf(NameBuff, MAXPATHL, "%s/%s", exp, ((char **)ga.ga_data)[i]);
|
vim_snprintf(NameBuff, MAXPATHL, "%s/%s", exp, ((char **)ga.ga_data)[i]);
|
||||||
if (delete_recursive((const char *)NameBuff) != 0) {
|
if (delete_recursive(NameBuff) != 0) {
|
||||||
// Remember the failure but continue deleting any further
|
// Remember the failure but continue deleting any further
|
||||||
// entries.
|
// entries.
|
||||||
result = -1;
|
result = -1;
|
||||||
|
@ -1786,7 +1786,7 @@ char *get_foldtext(win_T *wp, linenr_T lnum, linenr_T lnume, foldinfo_T foldinfo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*p != NUL) {
|
if (*p != NUL) {
|
||||||
p = transstr((const char *)text, true);
|
p = transstr(text, true);
|
||||||
xfree(text);
|
xfree(text);
|
||||||
text = p;
|
text = p;
|
||||||
}
|
}
|
||||||
|
@ -976,7 +976,7 @@ static void helptags_one(char *dir, const char *ext, const char *tagfname, bool
|
|||||||
}
|
}
|
||||||
p1 = vim_strchr(IObuff, '*'); // find first '*'
|
p1 = vim_strchr(IObuff, '*'); // find first '*'
|
||||||
while (p1 != NULL) {
|
while (p1 != NULL) {
|
||||||
p2 = strchr((const char *)p1 + 1, '*'); // Find second '*'.
|
p2 = strchr(p1 + 1, '*'); // Find second '*'.
|
||||||
if (p2 != NULL && p2 > p1 + 1) { // Skip "*" and "**".
|
if (p2 != NULL && p2 > p1 + 1) { // Skip "*" and "**".
|
||||||
for (s = p1 + 1; s < p2; s++) {
|
for (s = p1 + 1; s < p2; s++) {
|
||||||
if (*s == ' ' || *s == '\t' || *s == '|') {
|
if (*s == ' ' || *s == '\t' || *s == '|') {
|
||||||
|
@ -895,15 +895,15 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
bool dodefault = false;
|
bool dodefault = false;
|
||||||
|
|
||||||
// Isolate the name.
|
// Isolate the name.
|
||||||
const char *name_end = (const char *)skiptowhite(line);
|
const char *name_end = skiptowhite(line);
|
||||||
const char *linep = (const char *)skipwhite(name_end);
|
const char *linep = skipwhite(name_end);
|
||||||
|
|
||||||
// Check for "default" argument.
|
// Check for "default" argument.
|
||||||
if (strncmp(line, "default", (size_t)(name_end - line)) == 0) {
|
if (strncmp(line, "default", (size_t)(name_end - line)) == 0) {
|
||||||
dodefault = true;
|
dodefault = true;
|
||||||
line = linep;
|
line = linep;
|
||||||
name_end = (const char *)skiptowhite(line);
|
name_end = skiptowhite(line);
|
||||||
linep = (const char *)skipwhite(name_end);
|
linep = skipwhite(name_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool doclear = false;
|
bool doclear = false;
|
||||||
@ -937,9 +937,9 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
int to_id;
|
int to_id;
|
||||||
HlGroup *hlgroup = NULL;
|
HlGroup *hlgroup = NULL;
|
||||||
|
|
||||||
from_end = (const char *)skiptowhite(from_start);
|
from_end = skiptowhite(from_start);
|
||||||
to_start = (const char *)skipwhite(from_end);
|
to_start = skipwhite(from_end);
|
||||||
to_end = (const char *)skiptowhite(to_start);
|
to_end = skiptowhite(to_start);
|
||||||
|
|
||||||
if (ends_excmd((uint8_t)(*from_start))
|
if (ends_excmd((uint8_t)(*from_start))
|
||||||
|| ends_excmd((uint8_t)(*to_start))) {
|
|| ends_excmd((uint8_t)(*to_start))) {
|
||||||
@ -1015,8 +1015,8 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
redraw_all_later(UPD_NOT_VALID);
|
redraw_all_later(UPD_NOT_VALID);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
name_end = (const char *)skiptowhite(line);
|
name_end = skiptowhite(line);
|
||||||
linep = (const char *)skipwhite(name_end);
|
linep = skipwhite(name_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the group name in the table. If it does not exist yet, add it.
|
// Find the group name in the table. If it does not exist yet, add it.
|
||||||
@ -1073,7 +1073,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
memcpy(key, key_start, key_len);
|
memcpy(key, key_start, key_len);
|
||||||
key[key_len] = NUL;
|
key[key_len] = NUL;
|
||||||
vim_strup(key);
|
vim_strup(key);
|
||||||
linep = (const char *)skipwhite(linep);
|
linep = skipwhite(linep);
|
||||||
|
|
||||||
if (strcmp(key, "NONE") == 0) {
|
if (strcmp(key, "NONE") == 0) {
|
||||||
if (!init || hl_table[idx].sg_set == 0) {
|
if (!init || hl_table[idx].sg_set == 0) {
|
||||||
@ -1094,7 +1094,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
linep++;
|
linep++;
|
||||||
|
|
||||||
// Isolate the argument.
|
// Isolate the argument.
|
||||||
linep = (const char *)skipwhite(linep);
|
linep = skipwhite(linep);
|
||||||
if (*linep == '\'') { // guifg='color name'
|
if (*linep == '\'') { // guifg='color name'
|
||||||
arg_start = ++linep;
|
arg_start = ++linep;
|
||||||
linep = strchr(linep, '\'');
|
linep = strchr(linep, '\'');
|
||||||
@ -1105,7 +1105,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
arg_start = linep;
|
arg_start = linep;
|
||||||
linep = (const char *)skiptowhite(linep);
|
linep = skiptowhite(linep);
|
||||||
}
|
}
|
||||||
if (linep == arg_start) {
|
if (linep == arg_start) {
|
||||||
semsg(_("E417: missing argument: %s"), key_start);
|
semsg(_("E417: missing argument: %s"), key_start);
|
||||||
@ -1361,7 +1361,7 @@ void do_highlight(const char *line, const bool forceit, const bool init)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Continue with next argument.
|
// Continue with next argument.
|
||||||
linep = (const char *)skipwhite(linep);
|
linep = skipwhite(linep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2211,7 +2211,7 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// (part of) subcommand already typed
|
// (part of) subcommand already typed
|
||||||
const char *p = (const char *)skiptowhite(arg);
|
const char *p = skiptowhite(arg);
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -2219,9 +2219,9 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
|
|||||||
// past "default" or group name
|
// past "default" or group name
|
||||||
include_default = 0;
|
include_default = 0;
|
||||||
if (strncmp("default", arg, (unsigned)(p - arg)) == 0) {
|
if (strncmp("default", arg, (unsigned)(p - arg)) == 0) {
|
||||||
arg = (const char *)skipwhite(p);
|
arg = skipwhite(p);
|
||||||
xp->xp_pattern = (char *)arg;
|
xp->xp_pattern = (char *)arg;
|
||||||
p = (const char *)skiptowhite(arg);
|
p = skiptowhite(arg);
|
||||||
}
|
}
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
return;
|
return;
|
||||||
@ -2235,10 +2235,10 @@ void set_context_in_highlight_cmd(expand_T *xp, const char *arg)
|
|||||||
if (strncmp("link", arg, (unsigned)(p - arg)) == 0
|
if (strncmp("link", arg, (unsigned)(p - arg)) == 0
|
||||||
|| strncmp("clear", arg, (unsigned)(p - arg)) == 0) {
|
|| strncmp("clear", arg, (unsigned)(p - arg)) == 0) {
|
||||||
xp->xp_pattern = skipwhite(p);
|
xp->xp_pattern = skipwhite(p);
|
||||||
p = (const char *)skiptowhite(xp->xp_pattern);
|
p = skiptowhite(xp->xp_pattern);
|
||||||
if (*p != NUL) { // past first group name
|
if (*p != NUL) { // past first group name
|
||||||
xp->xp_pattern = skipwhite(p);
|
xp->xp_pattern = skipwhite(p);
|
||||||
p = (const char *)skiptowhite(xp->xp_pattern);
|
p = skiptowhite(xp->xp_pattern);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*p != NUL) { // past group name(s)
|
if (*p != NUL) { // past group name(s)
|
||||||
@ -2301,7 +2301,7 @@ const char *get_highlight_name_ext(expand_T *xp, int idx, bool skip_cleared)
|
|||||||
} else if (idx >= highlight_ga.ga_len) {
|
} else if (idx >= highlight_ga.ga_len) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
return (const char *)hl_table[idx].sg_name;
|
return hl_table[idx].sg_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
color_name_table_T color_name_table[] = {
|
color_name_table_T color_name_table[] = {
|
||||||
|
@ -1414,7 +1414,7 @@ static int thesaurus_add_words_in_line(char *fname, char **buf_arg, int dir, con
|
|||||||
// different classes, only separate words
|
// different classes, only separate words
|
||||||
// with single-byte non-word characters.
|
// with single-byte non-word characters.
|
||||||
while (*ptr != NUL) {
|
while (*ptr != NUL) {
|
||||||
const int l = utfc_ptr2len((const char *)ptr);
|
const int l = utfc_ptr2len(ptr);
|
||||||
|
|
||||||
if (l < 2 && !vim_iswordc((uint8_t)(*ptr))) {
|
if (l < 2 && !vim_iswordc((uint8_t)(*ptr))) {
|
||||||
break;
|
break;
|
||||||
@ -2515,7 +2515,7 @@ static void ins_compl_add_dict(dict_T *dict)
|
|||||||
compl_opt_refresh_always = false;
|
compl_opt_refresh_always = false;
|
||||||
di_refresh = tv_dict_find(dict, S_LEN("refresh"));
|
di_refresh = tv_dict_find(dict, S_LEN("refresh"));
|
||||||
if (di_refresh != NULL && di_refresh->di_tv.v_type == VAR_STRING) {
|
if (di_refresh != NULL && di_refresh->di_tv.v_type == VAR_STRING) {
|
||||||
const char *v = (const char *)di_refresh->di_tv.vval.v_string;
|
const char *v = di_refresh->di_tv.vval.v_string;
|
||||||
|
|
||||||
if (v != NULL && strcmp(v, "always") == 0) {
|
if (v != NULL && strcmp(v, "always") == 0) {
|
||||||
compl_opt_refresh_always = true;
|
compl_opt_refresh_always = true;
|
||||||
@ -4301,7 +4301,7 @@ static void ins_compl_show_statusmsg(void)
|
|||||||
if (edit_submode_extra != NULL) {
|
if (edit_submode_extra != NULL) {
|
||||||
if (!p_smd) {
|
if (!p_smd) {
|
||||||
msg_hist_off = true;
|
msg_hist_off = true;
|
||||||
msg_attr((const char *)edit_submode_extra,
|
msg_attr(edit_submode_extra,
|
||||||
(edit_submode_highl < HLF_COUNT
|
(edit_submode_highl < HLF_COUNT
|
||||||
? HL_ATTR(edit_submode_highl) : 0));
|
? HL_ATTR(edit_submode_highl) : 0));
|
||||||
msg_hist_off = false;
|
msg_hist_off = false;
|
||||||
|
@ -459,7 +459,7 @@ static bool typval_conv_special = false;
|
|||||||
TYPVAL_ENCODE_CONV_NUMBER(tv, flt)
|
TYPVAL_ENCODE_CONV_NUMBER(tv, flt)
|
||||||
|
|
||||||
#define TYPVAL_ENCODE_CONV_STRING(tv, str, len) \
|
#define TYPVAL_ENCODE_CONV_STRING(tv, str, len) \
|
||||||
lua_pushlstring(lstate, (const char *)(str), (len))
|
lua_pushlstring(lstate, (str), (len))
|
||||||
|
|
||||||
#define TYPVAL_ENCODE_CONV_STR_STRING TYPVAL_ENCODE_CONV_STRING
|
#define TYPVAL_ENCODE_CONV_STR_STRING TYPVAL_ENCODE_CONV_STRING
|
||||||
|
|
||||||
@ -469,9 +469,7 @@ static bool typval_conv_special = false;
|
|||||||
#define TYPVAL_ENCODE_CONV_BLOB(tv, blob, len) \
|
#define TYPVAL_ENCODE_CONV_BLOB(tv, blob, len) \
|
||||||
do { \
|
do { \
|
||||||
const blob_T *const blob_ = (blob); \
|
const blob_T *const blob_ = (blob); \
|
||||||
lua_pushlstring(lstate, \
|
lua_pushlstring(lstate, blob_ != NULL ? blob_->bv_ga.ga_data : "", (size_t)(len)); \
|
||||||
blob_ != NULL ? (const char *)blob_->bv_ga.ga_data : "", \
|
|
||||||
(size_t)(len)); \
|
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
|
#define TYPVAL_ENCODE_CONV_FUNC_START(tv, fun) \
|
||||||
|
@ -1105,7 +1105,7 @@ static int nlua_debug(lua_State *lstate)
|
|||||||
tv_clear(&input);
|
tv_clear(&input);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (luaL_loadbuffer(lstate, (const char *)input.vval.v_string,
|
if (luaL_loadbuffer(lstate, input.vval.v_string,
|
||||||
strlen(input.vval.v_string), "=(debug command)")) {
|
strlen(input.vval.v_string), "=(debug command)")) {
|
||||||
nlua_error(lstate, _("E5115: Error while loading debug string: %.*s"));
|
nlua_error(lstate, _("E5115: Error while loading debug string: %.*s"));
|
||||||
} else if (nlua_pcall(lstate, 0, 0)) {
|
} else if (nlua_pcall(lstate, 0, 0)) {
|
||||||
@ -1652,7 +1652,7 @@ void ex_luado(exarg_T *const eap)
|
|||||||
emsg(_("cannot save undo information"));
|
emsg(_("cannot save undo information"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const char *const cmd = (const char *)eap->arg;
|
const char *const cmd = eap->arg;
|
||||||
const size_t cmd_len = strlen(cmd);
|
const size_t cmd_len = strlen(cmd);
|
||||||
|
|
||||||
lua_State *const lstate = global_lstate;
|
lua_State *const lstate = global_lstate;
|
||||||
@ -1693,7 +1693,7 @@ void ex_luado(exarg_T *const eap)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
lua_pushvalue(lstate, -1);
|
lua_pushvalue(lstate, -1);
|
||||||
const char *const old_line = (const char *)ml_get_buf(curbuf, l, false);
|
const char *const old_line = ml_get_buf(curbuf, l, false);
|
||||||
// Get length of old_line here as calling Lua code may free it.
|
// Get length of old_line here as calling Lua code may free it.
|
||||||
const size_t old_line_len = strlen(old_line);
|
const size_t old_line_len = strlen(old_line);
|
||||||
lua_pushstring(lstate, old_line);
|
lua_pushstring(lstate, old_line);
|
||||||
@ -1729,7 +1729,7 @@ void ex_luado(exarg_T *const eap)
|
|||||||
void ex_luafile(exarg_T *const eap)
|
void ex_luafile(exarg_T *const eap)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
nlua_exec_file((const char *)eap->arg);
|
nlua_exec_file(eap->arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Executes Lua code from a file or "-" (stdin).
|
/// Executes Lua code from a file or "-" (stdin).
|
||||||
@ -1860,7 +1860,7 @@ int nlua_expand_pat(expand_T *xp, char *pat, int *num_results, char ***results)
|
|||||||
luaL_checktype(lstate, -1, LUA_TFUNCTION);
|
luaL_checktype(lstate, -1, LUA_TFUNCTION);
|
||||||
|
|
||||||
// [ vim, vim._expand_pat, buf ]
|
// [ vim, vim._expand_pat, buf ]
|
||||||
lua_pushlstring(lstate, (const char *)pat, strlen(pat));
|
lua_pushlstring(lstate, pat, strlen(pat));
|
||||||
|
|
||||||
if (nlua_pcall(lstate, 1, 2) != 0) {
|
if (nlua_pcall(lstate, 1, 2) != 0) {
|
||||||
nlua_error(lstate,
|
nlua_error(lstate,
|
||||||
@ -2092,7 +2092,7 @@ int nlua_do_ucmd(ucmd_T *cmd, exarg_T *eap, bool preview)
|
|||||||
lua_setfield(lstate, -2, "line2");
|
lua_setfield(lstate, -2, "line2");
|
||||||
|
|
||||||
lua_newtable(lstate); // f-args table
|
lua_newtable(lstate); // f-args table
|
||||||
lua_pushstring(lstate, (const char *)eap->arg);
|
lua_pushstring(lstate, eap->arg);
|
||||||
lua_pushvalue(lstate, -1); // Reference for potential use on f-args
|
lua_pushvalue(lstate, -1); // Reference for potential use on f-args
|
||||||
lua_setfield(lstate, -4, "args");
|
lua_setfield(lstate, -4, "args");
|
||||||
|
|
||||||
|
@ -1501,7 +1501,7 @@ bool check_abbr(int c, char *ptr, int col, int mincol)
|
|||||||
char *q = mp->m_keys;
|
char *q = mp->m_keys;
|
||||||
int match;
|
int match;
|
||||||
|
|
||||||
if (strchr((const char *)mp->m_keys, K_SPECIAL) != NULL) {
|
if (strchr(mp->m_keys, K_SPECIAL) != NULL) {
|
||||||
// Might have K_SPECIAL escaped mp->m_keys.
|
// Might have K_SPECIAL escaped mp->m_keys.
|
||||||
q = xstrdup(mp->m_keys);
|
q = xstrdup(mp->m_keys);
|
||||||
vim_unescape_ks(q);
|
vim_unescape_ks(q);
|
||||||
@ -1811,8 +1811,7 @@ int makemap(FILE *fd, buf_T *buf)
|
|||||||
did_cpo = true;
|
did_cpo = true;
|
||||||
} else {
|
} else {
|
||||||
const char specials[] = { (char)(uint8_t)K_SPECIAL, NL, NUL };
|
const char specials[] = { (char)(uint8_t)K_SPECIAL, NL, NUL };
|
||||||
if (strpbrk((const char *)mp->m_str, specials) != NULL
|
if (strpbrk(mp->m_str, specials) != NULL || strpbrk(mp->m_keys, specials) != NULL) {
|
||||||
|| strpbrk((const char *)mp->m_keys, specials) != NULL) {
|
|
||||||
did_cpo = true;
|
did_cpo = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2091,7 +2090,7 @@ static Dictionary mapblock_fill_dict(const mapblock_T *const mp, const char *lhs
|
|||||||
PUT(dict, "desc", STRING_OBJ(cstr_to_string(mp->m_desc)));
|
PUT(dict, "desc", STRING_OBJ(cstr_to_string(mp->m_desc)));
|
||||||
}
|
}
|
||||||
PUT(dict, "lhs", STRING_OBJ(cstr_as_string(lhs)));
|
PUT(dict, "lhs", STRING_OBJ(cstr_as_string(lhs)));
|
||||||
PUT(dict, "lhsraw", STRING_OBJ(cstr_to_string((const char *)mp->m_keys)));
|
PUT(dict, "lhsraw", STRING_OBJ(cstr_to_string(mp->m_keys)));
|
||||||
if (lhsrawalt != NULL) {
|
if (lhsrawalt != NULL) {
|
||||||
// Also add the value for the simplified entry.
|
// Also add the value for the simplified entry.
|
||||||
PUT(dict, "lhsrawalt", STRING_OBJ(cstr_to_string(lhsrawalt)));
|
PUT(dict, "lhsrawalt", STRING_OBJ(cstr_to_string(lhsrawalt)));
|
||||||
|
@ -938,10 +938,9 @@ void f_getmatches(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
tv_dict_add_list(dict, buf, (size_t)len, l);
|
tv_dict_add_list(dict, buf, (size_t)len, l);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
tv_dict_add_str(dict, S_LEN("pattern"), (const char *)cur->mit_pattern);
|
tv_dict_add_str(dict, S_LEN("pattern"), cur->mit_pattern);
|
||||||
}
|
}
|
||||||
tv_dict_add_str(dict, S_LEN("group"),
|
tv_dict_add_str(dict, S_LEN("group"), syn_id2name(cur->mit_hlg_id));
|
||||||
(const char *)syn_id2name(cur->mit_hlg_id));
|
|
||||||
tv_dict_add_nr(dict, S_LEN("priority"), (varnumber_T)cur->mit_priority);
|
tv_dict_add_nr(dict, S_LEN("priority"), (varnumber_T)cur->mit_priority);
|
||||||
tv_dict_add_nr(dict, S_LEN("id"), (varnumber_T)cur->mit_id);
|
tv_dict_add_nr(dict, S_LEN("id"), (varnumber_T)cur->mit_id);
|
||||||
|
|
||||||
@ -1166,9 +1165,8 @@ void f_matcharg(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
matchitem_T *const m = get_match(curwin, id);
|
matchitem_T *const m = get_match(curwin, id);
|
||||||
|
|
||||||
if (m != NULL) {
|
if (m != NULL) {
|
||||||
tv_list_append_string(rettv->vval.v_list,
|
tv_list_append_string(rettv->vval.v_list, syn_id2name(m->mit_hlg_id), -1);
|
||||||
(const char *)syn_id2name(m->mit_hlg_id), -1);
|
tv_list_append_string(rettv->vval.v_list, m->mit_pattern, -1);
|
||||||
tv_list_append_string(rettv->vval.v_list, (const char *)m->mit_pattern, -1);
|
|
||||||
} else {
|
} else {
|
||||||
tv_list_append_string(rettv->vval.v_list, NULL, 0);
|
tv_list_append_string(rettv->vval.v_list, NULL, 0);
|
||||||
tv_list_append_string(rettv->vval.v_list, NULL, 0);
|
tv_list_append_string(rettv->vval.v_list, NULL, 0);
|
||||||
|
@ -1351,7 +1351,7 @@ int recover_names(char *fname, int list, int nr, char **fname_out)
|
|||||||
// print the swap file name
|
// print the swap file name
|
||||||
msg_outnum((long)++file_count);
|
msg_outnum((long)++file_count);
|
||||||
msg_puts(". ");
|
msg_puts(". ");
|
||||||
msg_puts((const char *)path_tail(files[i]));
|
msg_puts(path_tail(files[i]));
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
(void)swapfile_info(files[i]);
|
(void)swapfile_info(files[i]);
|
||||||
}
|
}
|
||||||
@ -1508,7 +1508,7 @@ static time_t swapfile_info(char *fname)
|
|||||||
if (char_to_long(b0.b0_pid) != 0L) {
|
if (char_to_long(b0.b0_pid) != 0L) {
|
||||||
msg_puts(_("\n process ID: "));
|
msg_puts(_("\n process ID: "));
|
||||||
msg_outnum(char_to_long(b0.b0_pid));
|
msg_outnum(char_to_long(b0.b0_pid));
|
||||||
if (swapfile_process_running(&b0, (const char *)fname)) {
|
if (swapfile_process_running(&b0, fname)) {
|
||||||
msg_puts(_(" (STILL RUNNING)"));
|
msg_puts(_(" (STILL RUNNING)"));
|
||||||
process_still_running = true;
|
process_still_running = true;
|
||||||
}
|
}
|
||||||
|
@ -1537,7 +1537,7 @@ const char *msg_outtrans_one(const char *p, int attr)
|
|||||||
msg_outtrans_len_attr(p, l, attr);
|
msg_outtrans_len_attr(p, l, attr);
|
||||||
return p + l;
|
return p + l;
|
||||||
}
|
}
|
||||||
msg_puts_attr((const char *)transchar_byte_buf(NULL, (uint8_t)(*p)), attr);
|
msg_puts_attr(transchar_byte_buf(NULL, (uint8_t)(*p)), attr);
|
||||||
return p + 1;
|
return p + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1582,8 +1582,7 @@ int msg_outtrans_len_attr(const char *msgstr, int len, int attr)
|
|||||||
msg_puts_attr_len(plain_start, str - plain_start, attr);
|
msg_puts_attr_len(plain_start, str - plain_start, attr);
|
||||||
}
|
}
|
||||||
plain_start = str + mb_l;
|
plain_start = str + mb_l;
|
||||||
msg_puts_attr((const char *)transchar_buf(NULL, c),
|
msg_puts_attr(transchar_buf(NULL, c), attr == 0 ? HL_ATTR(HLF_8) : attr);
|
||||||
(attr == 0 ? HL_ATTR(HLF_8) : attr));
|
|
||||||
retval += char2cells(c);
|
retval += char2cells(c);
|
||||||
}
|
}
|
||||||
len -= mb_l - 1;
|
len -= mb_l - 1;
|
||||||
@ -1777,7 +1776,7 @@ const char *str2special(const char **const sp, const bool replace_spaces, const
|
|||||||
|| c < ' '
|
|| c < ' '
|
||||||
|| (replace_spaces && c == ' ')
|
|| (replace_spaces && c == ' ')
|
||||||
|| (replace_lt && c == '<')) {
|
|| (replace_lt && c == '<')) {
|
||||||
return (const char *)get_special_key_name(c, modifiers);
|
return get_special_key_name(c, modifiers);
|
||||||
}
|
}
|
||||||
buf[0] = (char)c;
|
buf[0] = (char)c;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
|
@ -668,7 +668,7 @@ static void normal_redraw_mode_message(NormalState *s)
|
|||||||
keep_msg = kmsg;
|
keep_msg = kmsg;
|
||||||
|
|
||||||
kmsg = xstrdup(keep_msg);
|
kmsg = xstrdup(keep_msg);
|
||||||
msg_attr((const char *)kmsg, keep_msg_attr);
|
msg_attr(kmsg, keep_msg_attr);
|
||||||
xfree(kmsg);
|
xfree(kmsg);
|
||||||
}
|
}
|
||||||
setcursor();
|
setcursor();
|
||||||
@ -1336,7 +1336,7 @@ static void normal_redraw(NormalState *s)
|
|||||||
// check for duplicates. Never put this message in
|
// check for duplicates. Never put this message in
|
||||||
// history.
|
// history.
|
||||||
msg_hist_off = true;
|
msg_hist_off = true;
|
||||||
msg_attr((const char *)p, keep_msg_attr);
|
msg_attr(p, keep_msg_attr);
|
||||||
msg_hist_off = false;
|
msg_hist_off = false;
|
||||||
xfree(p);
|
xfree(p);
|
||||||
}
|
}
|
||||||
@ -3512,7 +3512,7 @@ static void nv_ident(cmdarg_T *cap)
|
|||||||
ptr = xstrnsave(ptr, n);
|
ptr = xstrnsave(ptr, n);
|
||||||
if (kp_ex) {
|
if (kp_ex) {
|
||||||
// Escape the argument properly for an Ex command
|
// Escape the argument properly for an Ex command
|
||||||
p = vim_strsave_fnameescape((const char *)ptr, VSE_NONE);
|
p = vim_strsave_fnameescape(ptr, VSE_NONE);
|
||||||
} else {
|
} else {
|
||||||
// Escape the argument properly for a shell command
|
// Escape the argument properly for a shell command
|
||||||
p = vim_strsave_shellescape(ptr, true, true);
|
p = vim_strsave_shellescape(ptr, true, true);
|
||||||
@ -5334,7 +5334,7 @@ static void nv_g_dollar_cmd(cmdarg_T *cap)
|
|||||||
coladvance((colnr_T)i);
|
coladvance((colnr_T)i);
|
||||||
|
|
||||||
// if the character doesn't fit move one back
|
// if the character doesn't fit move one back
|
||||||
if (curwin->w_cursor.col > 0 && utf_ptr2cells((const char *)get_cursor_pos_ptr()) > 1) {
|
if (curwin->w_cursor.col > 0 && utf_ptr2cells(get_cursor_pos_ptr()) > 1) {
|
||||||
colnr_T vcol;
|
colnr_T vcol;
|
||||||
|
|
||||||
getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol);
|
getvvcol(curwin, &curwin->w_cursor, NULL, NULL, &vcol);
|
||||||
|
@ -926,7 +926,7 @@ int do_record(int c)
|
|||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
// Remove escaping for K_SPECIAL in multi-byte chars.
|
// Remove escaping for K_SPECIAL in multi-byte chars.
|
||||||
vim_unescape_ks(p);
|
vim_unescape_ks(p);
|
||||||
(void)tv_dict_add_str(dict, S_LEN("regcontents"), (const char *)p);
|
(void)tv_dict_add_str(dict, S_LEN("regcontents"), p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Name of requested register, or empty string for unnamed operation.
|
// Name of requested register, or empty string for unnamed operation.
|
||||||
@ -1273,7 +1273,7 @@ int insert_reg(int regname, bool literally_arg)
|
|||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
stuffescaped((const char *)arg, literally);
|
stuffescaped(arg, literally);
|
||||||
if (allocated) {
|
if (allocated) {
|
||||||
xfree(arg);
|
xfree(arg);
|
||||||
}
|
}
|
||||||
@ -1288,7 +1288,7 @@ int insert_reg(int regname, bool literally_arg)
|
|||||||
AppendCharToRedobuff(regname);
|
AppendCharToRedobuff(regname);
|
||||||
do_put(regname, NULL, BACKWARD, 1L, PUT_CURSEND);
|
do_put(regname, NULL, BACKWARD, 1L, PUT_CURSEND);
|
||||||
} else {
|
} else {
|
||||||
stuffescaped((const char *)reg->y_array[i], literally);
|
stuffescaped(reg->y_array[i], literally);
|
||||||
}
|
}
|
||||||
// Insert a newline between lines and after last line if
|
// Insert a newline between lines and after last line if
|
||||||
// y_type is kMTLineWise.
|
// y_type is kMTLineWise.
|
||||||
@ -2867,7 +2867,7 @@ static void do_autocmd_textyankpost(oparg_T *oap, yankreg_T *reg)
|
|||||||
// The yanked text contents.
|
// The yanked text contents.
|
||||||
list_T *const list = tv_list_alloc((ptrdiff_t)reg->y_size);
|
list_T *const list = tv_list_alloc((ptrdiff_t)reg->y_size);
|
||||||
for (size_t i = 0; i < reg->y_size; i++) {
|
for (size_t i = 0; i < reg->y_size; i++) {
|
||||||
tv_list_append_string(list, (const char *)reg->y_array[i], -1);
|
tv_list_append_string(list, reg->y_array[i], -1);
|
||||||
}
|
}
|
||||||
tv_list_set_lock(list, VAR_FIXED);
|
tv_list_set_lock(list, VAR_FIXED);
|
||||||
(void)tv_dict_add_list(dict, S_LEN("regcontents"), list);
|
(void)tv_dict_add_list(dict, S_LEN("regcontents"), list);
|
||||||
@ -4963,7 +4963,7 @@ void *get_reg_contents(int regname, int flags)
|
|||||||
if (flags & kGRegList) {
|
if (flags & kGRegList) {
|
||||||
list_T *const list = tv_list_alloc((ptrdiff_t)reg->y_size);
|
list_T *const list = tv_list_alloc((ptrdiff_t)reg->y_size);
|
||||||
for (size_t i = 0; i < reg->y_size; i++) {
|
for (size_t i = 0; i < reg->y_size; i++) {
|
||||||
tv_list_append_string(list, (const char *)reg->y_array[i], -1);
|
tv_list_append_string(list, reg->y_array[i], -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
@ -5608,13 +5608,13 @@ static void op_colon(oparg_T *oap)
|
|||||||
stuffReadbuff("!");
|
stuffReadbuff("!");
|
||||||
}
|
}
|
||||||
if (oap->op_type == OP_INDENT) {
|
if (oap->op_type == OP_INDENT) {
|
||||||
stuffReadbuff((const char *)get_equalprg());
|
stuffReadbuff(get_equalprg());
|
||||||
stuffReadbuff("\n");
|
stuffReadbuff("\n");
|
||||||
} else if (oap->op_type == OP_FORMAT) {
|
} else if (oap->op_type == OP_FORMAT) {
|
||||||
if (*curbuf->b_p_fp != NUL) {
|
if (*curbuf->b_p_fp != NUL) {
|
||||||
stuffReadbuff((const char *)curbuf->b_p_fp);
|
stuffReadbuff(curbuf->b_p_fp);
|
||||||
} else if (*p_fp != NUL) {
|
} else if (*p_fp != NUL) {
|
||||||
stuffReadbuff((const char *)p_fp);
|
stuffReadbuff(p_fp);
|
||||||
} else {
|
} else {
|
||||||
stuffReadbuff("fmt");
|
stuffReadbuff("fmt");
|
||||||
}
|
}
|
||||||
@ -6639,7 +6639,7 @@ static bool get_clipboard(int name, yankreg_T **target, bool quiet)
|
|||||||
if (TV_LIST_ITEM_TV(li)->v_type != VAR_STRING) {
|
if (TV_LIST_ITEM_TV(li)->v_type != VAR_STRING) {
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
reg->y_array[tv_idx++] = xstrdupnul((const char *)TV_LIST_ITEM_TV(li)->vval.v_string);
|
reg->y_array[tv_idx++] = xstrdupnul(TV_LIST_ITEM_TV(li)->vval.v_string);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (reg->y_size > 0 && strlen(reg->y_array[reg->y_size - 1]) == 0) {
|
if (reg->y_size > 0 && strlen(reg->y_array[reg->y_size - 1]) == 0) {
|
||||||
@ -6700,7 +6700,7 @@ static void set_clipboard(int name, yankreg_T *reg)
|
|||||||
list_T *const lines = tv_list_alloc((ptrdiff_t)reg->y_size + (reg->y_type != kMTCharWise));
|
list_T *const lines = tv_list_alloc((ptrdiff_t)reg->y_size + (reg->y_type != kMTCharWise));
|
||||||
|
|
||||||
for (size_t i = 0; i < reg->y_size; i++) {
|
for (size_t i = 0; i < reg->y_size; i++) {
|
||||||
tv_list_append_string(lines, (const char *)reg->y_array[i], -1);
|
tv_list_append_string(lines, reg->y_array[i], -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
char regtype;
|
char regtype;
|
||||||
@ -6910,7 +6910,7 @@ bcount_t get_region_bytecount(buf_T *buf, linenr_T start_lnum, linenr_T end_lnum
|
|||||||
if (start_lnum == end_lnum) {
|
if (start_lnum == end_lnum) {
|
||||||
return end_col - start_col;
|
return end_col - start_col;
|
||||||
}
|
}
|
||||||
const char *first = (const char *)ml_get_buf(buf, start_lnum, false);
|
const char *first = ml_get_buf(buf, start_lnum, false);
|
||||||
bcount_t deleted_bytes = (bcount_t)strlen(first) - start_col + 1;
|
bcount_t deleted_bytes = (bcount_t)strlen(first) - start_col + 1;
|
||||||
|
|
||||||
for (linenr_T i = 1; i <= end_lnum - start_lnum - 1; i++) {
|
for (linenr_T i = 1; i <= end_lnum - start_lnum - 1; i++) {
|
||||||
|
@ -1235,7 +1235,7 @@ static int parse_option_name(char *arg, int *keyp, int *lenp, int *opt_idxp)
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
if (arg[1] == 't' && arg[2] == '_') { // could be term code
|
if (arg[1] == 't' && arg[2] == '_') { // could be term code
|
||||||
opt_idx = findoption_len((const char *)arg + 1, (size_t)(len - 1));
|
opt_idx = findoption_len(arg + 1, (size_t)(len - 1));
|
||||||
}
|
}
|
||||||
len++;
|
len++;
|
||||||
if (opt_idx == -1) {
|
if (opt_idx == -1) {
|
||||||
@ -1251,7 +1251,7 @@ static int parse_option_name(char *arg, int *keyp, int *lenp, int *opt_idxp)
|
|||||||
len++;
|
len++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
opt_idx = findoption_len((const char *)arg, (size_t)len);
|
opt_idx = findoption_len(arg, (size_t)len);
|
||||||
if (opt_idx == -1) {
|
if (opt_idx == -1) {
|
||||||
key = find_key_option(arg, false);
|
key = find_key_option(arg, false);
|
||||||
}
|
}
|
||||||
@ -1869,7 +1869,7 @@ void check_blending(win_T *wp)
|
|||||||
/// Handle setting `winhighlight' in window "wp"
|
/// Handle setting `winhighlight' in window "wp"
|
||||||
bool parse_winhl_opt(win_T *wp)
|
bool parse_winhl_opt(win_T *wp)
|
||||||
{
|
{
|
||||||
const char *p = (const char *)wp->w_p_winhl;
|
const char *p = wp->w_p_winhl;
|
||||||
|
|
||||||
if (!*p) {
|
if (!*p) {
|
||||||
if (wp->w_ns_hl_winhl && wp->w_ns_hl == wp->w_ns_hl_winhl) {
|
if (wp->w_ns_hl_winhl && wp->w_ns_hl == wp->w_ns_hl_winhl) {
|
||||||
@ -4694,7 +4694,7 @@ void set_context_in_set_cmd(expand_T *xp, char *arg, int opt_flags)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
nextchar = *p;
|
nextchar = *p;
|
||||||
opt_idx = findoption_len((const char *)arg, (size_t)(p - arg));
|
opt_idx = findoption_len(arg, (size_t)(p - arg));
|
||||||
if (opt_idx == -1 || options[opt_idx].var == NULL) {
|
if (opt_idx == -1 || options[opt_idx].var == NULL) {
|
||||||
xp->xp_context = EXPAND_NOTHING;
|
xp->xp_context = EXPAND_NOTHING;
|
||||||
return;
|
return;
|
||||||
@ -5509,7 +5509,7 @@ int win_signcol_count(win_T *wp)
|
|||||||
/// Return the number of requested sign columns, based on user / configuration.
|
/// Return the number of requested sign columns, based on user / configuration.
|
||||||
int win_signcol_configured(win_T *wp, int *is_fixed)
|
int win_signcol_configured(win_T *wp, int *is_fixed)
|
||||||
{
|
{
|
||||||
const char *scl = (const char *)wp->w_p_scl;
|
const char *scl = wp->w_p_scl;
|
||||||
|
|
||||||
if (is_fixed) {
|
if (is_fixed) {
|
||||||
*is_fixed = 1;
|
*is_fixed = 1;
|
||||||
@ -5607,7 +5607,7 @@ long get_sidescrolloff_value(win_T *wp)
|
|||||||
|
|
||||||
Dictionary get_vimoption(String name, int scope, buf_T *buf, win_T *win, Error *err)
|
Dictionary get_vimoption(String name, int scope, buf_T *buf, win_T *win, Error *err)
|
||||||
{
|
{
|
||||||
int opt_idx = findoption_len((const char *)name.data, name.size);
|
int opt_idx = findoption_len(name.data, name.size);
|
||||||
VALIDATE_S(opt_idx >= 0, "option (not found)", name.data, {
|
VALIDATE_S(opt_idx >= 0, "option (not found)", name.data, {
|
||||||
return (Dictionary)ARRAY_DICT_INIT;
|
return (Dictionary)ARRAY_DICT_INIT;
|
||||||
});
|
});
|
||||||
|
@ -845,7 +845,7 @@ const void *vim_env_iter(const char delim, const char *const val, const void *co
|
|||||||
const char **const dir, size_t *const len)
|
const char **const dir, size_t *const len)
|
||||||
FUNC_ATTR_NONNULL_ARG(2, 4, 5) FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_NONNULL_ARG(2, 4, 5) FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
const char *varval = (const char *)iter;
|
const char *varval = iter;
|
||||||
if (varval == NULL) {
|
if (varval == NULL) {
|
||||||
varval = val;
|
varval = val;
|
||||||
}
|
}
|
||||||
@ -876,7 +876,7 @@ const void *vim_env_iter_rev(const char delim, const char *const val, const void
|
|||||||
const char **const dir, size_t *const len)
|
const char **const dir, size_t *const len)
|
||||||
FUNC_ATTR_NONNULL_ARG(2, 4, 5) FUNC_ATTR_WARN_UNUSED_RESULT
|
FUNC_ATTR_NONNULL_ARG(2, 4, 5) FUNC_ATTR_WARN_UNUSED_RESULT
|
||||||
{
|
{
|
||||||
const char *varend = (const char *)iter;
|
const char *varend = iter;
|
||||||
if (varend == NULL) {
|
if (varend == NULL) {
|
||||||
varend = val + strlen(val) - 1;
|
varend = val + strlen(val) - 1;
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1180,7 @@ static size_t tokenize(const char *const str, char **const argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
argc++;
|
argc++;
|
||||||
p = (const char *)skipwhite((p + len));
|
p = skipwhite((p + len));
|
||||||
}
|
}
|
||||||
|
|
||||||
return argc;
|
return argc;
|
||||||
|
@ -973,7 +973,7 @@ static void uniquefy_paths(garray_T *gap, char *pattern)
|
|||||||
for (int i = 0; i < gap->ga_len && !got_int; i++) {
|
for (int i = 0; i < gap->ga_len && !got_int; i++) {
|
||||||
char *path = fnames[i];
|
char *path = fnames[i];
|
||||||
int is_in_curdir;
|
int is_in_curdir;
|
||||||
char *dir_end = (char *)gettail_dir((const char *)path);
|
char *dir_end = (char *)gettail_dir(path);
|
||||||
char *pathsep_p;
|
char *pathsep_p;
|
||||||
char *path_cutoff;
|
char *path_cutoff;
|
||||||
|
|
||||||
|
@ -5795,28 +5795,19 @@ static int get_qfline_items(qfline_T *qfp, list_T *list)
|
|||||||
buf[0] = qfp->qf_type;
|
buf[0] = qfp->qf_type;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
if (tv_dict_add_nr(dict, S_LEN("bufnr"), (varnumber_T)bufnum) == FAIL
|
if (tv_dict_add_nr(dict, S_LEN("bufnr"), (varnumber_T)bufnum) == FAIL
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("lnum"), (varnumber_T)qfp->qf_lnum)
|
|| (tv_dict_add_nr(dict, S_LEN("lnum"), (varnumber_T)qfp->qf_lnum) == FAIL)
|
||||||
== FAIL)
|
|| (tv_dict_add_nr(dict, S_LEN("end_lnum"), (varnumber_T)qfp->qf_end_lnum) == FAIL)
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("end_lnum"), (varnumber_T)qfp->qf_end_lnum)
|
|
||||||
== FAIL)
|
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("col"), (varnumber_T)qfp->qf_col) == FAIL)
|
|| (tv_dict_add_nr(dict, S_LEN("col"), (varnumber_T)qfp->qf_col) == FAIL)
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("end_col"), (varnumber_T)qfp->qf_end_col)
|
|| (tv_dict_add_nr(dict, S_LEN("end_col"), (varnumber_T)qfp->qf_end_col) == FAIL)
|
||||||
== FAIL)
|
|| (tv_dict_add_nr(dict, S_LEN("vcol"), (varnumber_T)qfp->qf_viscol) == FAIL)
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("vcol"), (varnumber_T)qfp->qf_viscol)
|
|
||||||
== FAIL)
|
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("nr"), (varnumber_T)qfp->qf_nr) == FAIL)
|
|| (tv_dict_add_nr(dict, S_LEN("nr"), (varnumber_T)qfp->qf_nr) == FAIL)
|
||||||
|| (tv_dict_add_str(dict, S_LEN("module"),
|
|| (tv_dict_add_str(dict, S_LEN("module"), (qfp->qf_module == NULL ? "" : qfp->qf_module))
|
||||||
(qfp->qf_module == NULL ? "" : (const char *)qfp->qf_module))
|
|
||||||
== FAIL)
|
== FAIL)
|
||||||
|| (tv_dict_add_str(dict, S_LEN("pattern"),
|
|| (tv_dict_add_str(dict, S_LEN("pattern"), (qfp->qf_pattern == NULL ? "" : qfp->qf_pattern))
|
||||||
(qfp->qf_pattern == NULL ? "" : (const char *)qfp->qf_pattern))
|
|
||||||
== FAIL)
|
== FAIL)
|
||||||
|| (tv_dict_add_str(dict, S_LEN("text"),
|
|| (tv_dict_add_str(dict, S_LEN("text"), (qfp->qf_text == NULL ? "" : qfp->qf_text)) == FAIL)
|
||||||
(qfp->qf_text == NULL ? "" : (const char *)qfp->qf_text))
|
|| (tv_dict_add_str(dict, S_LEN("type"), buf) == FAIL)
|
||||||
== FAIL)
|
|| (tv_dict_add_nr(dict, S_LEN("valid"), (varnumber_T)qfp->qf_valid) == FAIL)) {
|
||||||
|| (tv_dict_add_str(dict, S_LEN("type"), (const char *)buf) == FAIL)
|
|
||||||
|| (tv_dict_add_nr(dict, S_LEN("valid"), (varnumber_T)qfp->qf_valid)
|
|
||||||
== FAIL)) {
|
|
||||||
// tv_dict_add* fail only if key already exist, but this is a newly
|
// tv_dict_add* fail only if key already exist, but this is a newly
|
||||||
// allocated dictionary which is thus guaranteed to have no existing keys.
|
// allocated dictionary which is thus guaranteed to have no existing keys.
|
||||||
abort();
|
abort();
|
||||||
@ -6039,8 +6030,7 @@ static int qf_getprop_qfidx(qf_info_T *qi, dict_T *what)
|
|||||||
qf_idx = INVALID_QFIDX;
|
qf_idx = INVALID_QFIDX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (di->di_tv.v_type == VAR_STRING
|
} else if (di->di_tv.v_type == VAR_STRING && strequal(di->di_tv.vval.v_string, "$")) {
|
||||||
&& strequal((const char *)di->di_tv.vval.v_string, "$")) {
|
|
||||||
// Get the last quickfix list number
|
// Get the last quickfix list number
|
||||||
qf_idx = qi->qf_listcount - 1;
|
qf_idx = qi->qf_listcount - 1;
|
||||||
} else {
|
} else {
|
||||||
@ -6069,7 +6059,7 @@ static int qf_getprop_defaults(qf_info_T *qi, int flags, int locstack, dict_T *r
|
|||||||
int status = OK;
|
int status = OK;
|
||||||
|
|
||||||
if (flags & QF_GETLIST_TITLE) {
|
if (flags & QF_GETLIST_TITLE) {
|
||||||
status = tv_dict_add_str(retdict, S_LEN("title"), (const char *)"");
|
status = tv_dict_add_str(retdict, S_LEN("title"), "");
|
||||||
}
|
}
|
||||||
if ((status == OK) && (flags & QF_GETLIST_ITEMS)) {
|
if ((status == OK) && (flags & QF_GETLIST_ITEMS)) {
|
||||||
list_T *l = tv_list_alloc(kListLenMayKnow);
|
list_T *l = tv_list_alloc(kListLenMayKnow);
|
||||||
@ -6082,7 +6072,7 @@ static int qf_getprop_defaults(qf_info_T *qi, int flags, int locstack, dict_T *r
|
|||||||
status = tv_dict_add_nr(retdict, S_LEN("winid"), qf_winid(qi));
|
status = tv_dict_add_nr(retdict, S_LEN("winid"), qf_winid(qi));
|
||||||
}
|
}
|
||||||
if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) {
|
if ((status == OK) && (flags & QF_GETLIST_CONTEXT)) {
|
||||||
status = tv_dict_add_str(retdict, S_LEN("context"), (const char *)"");
|
status = tv_dict_add_str(retdict, S_LEN("context"), "");
|
||||||
}
|
}
|
||||||
if ((status == OK) && (flags & QF_GETLIST_ID)) {
|
if ((status == OK) && (flags & QF_GETLIST_ID)) {
|
||||||
status = tv_dict_add_nr(retdict, S_LEN("id"), 0);
|
status = tv_dict_add_nr(retdict, S_LEN("id"), 0);
|
||||||
@ -6112,8 +6102,7 @@ static int qf_getprop_defaults(qf_info_T *qi, int flags, int locstack, dict_T *r
|
|||||||
/// Return the quickfix list title as 'title' in retdict
|
/// Return the quickfix list title as 'title' in retdict
|
||||||
static int qf_getprop_title(qf_list_T *qfl, dict_T *retdict)
|
static int qf_getprop_title(qf_list_T *qfl, dict_T *retdict)
|
||||||
{
|
{
|
||||||
return tv_dict_add_str(retdict, S_LEN("title"),
|
return tv_dict_add_str(retdict, S_LEN("title"), qfl->qf_title);
|
||||||
(const char *)qfl->qf_title);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns the identifier of the window used to display files from a location
|
// Returns the identifier of the window used to display files from a location
|
||||||
@ -6462,8 +6451,7 @@ static int qf_setprop_get_qfidx(const qf_info_T *qi, const dict_T *what, int act
|
|||||||
} else if (action != ' ') {
|
} else if (action != ' ') {
|
||||||
*newlist = false; // use the specified list
|
*newlist = false; // use the specified list
|
||||||
}
|
}
|
||||||
} else if (di->di_tv.v_type == VAR_STRING
|
} else if (di->di_tv.v_type == VAR_STRING && strequal(di->di_tv.vval.v_string, "$")) {
|
||||||
&& strequal((const char *)di->di_tv.vval.v_string, "$")) {
|
|
||||||
if (!qf_stack_empty(qi)) {
|
if (!qf_stack_empty(qi)) {
|
||||||
qf_idx = qi->qf_listcount - 1;
|
qf_idx = qi->qf_listcount - 1;
|
||||||
} else if (*newlist) {
|
} else if (*newlist) {
|
||||||
|
@ -97,7 +97,7 @@ static int toggle_Magic(int x)
|
|||||||
#define EMSG2_RET_NULL(m, c) \
|
#define EMSG2_RET_NULL(m, c) \
|
||||||
return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, (void *)NULL)
|
return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, (void *)NULL)
|
||||||
#define EMSG3_RET_NULL(m, c, a) \
|
#define EMSG3_RET_NULL(m, c, a) \
|
||||||
return (semsg((const char *)(m), (c) ? "" : "\\", (a)), rc_did_emsg = true, (void *)NULL)
|
return (semsg((m), (c) ? "" : "\\", (a)), rc_did_emsg = true, (void *)NULL)
|
||||||
#define EMSG2_RET_FAIL(m, c) \
|
#define EMSG2_RET_FAIL(m, c) \
|
||||||
return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
|
return (semsg((m), (c) ? "" : "\\"), rc_did_emsg = true, FAIL)
|
||||||
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
|
#define EMSG_ONE_RET_NULL EMSG2_RET_NULL(_("E369: invalid item in %s%%[]"), reg_magic == MAGIC_ALL)
|
||||||
@ -2237,12 +2237,12 @@ list_T *reg_submatch_list(int no)
|
|||||||
tv_list_append_string(list, s, ecol);
|
tv_list_append_string(list, s, ecol);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
s = (const char *)rsm.sm_match->startp[no];
|
s = rsm.sm_match->startp[no];
|
||||||
if (s == NULL || rsm.sm_match->endp[no] == NULL) {
|
if (s == NULL || rsm.sm_match->endp[no] == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
list = tv_list_alloc(1);
|
list = tv_list_alloc(1);
|
||||||
tv_list_append_string(list, s, (const char *)rsm.sm_match->endp[no] - s);
|
tv_list_append_string(list, s, rsm.sm_match->endp[no] - s);
|
||||||
}
|
}
|
||||||
|
|
||||||
tv_list_ref(list);
|
tv_list_ref(list);
|
||||||
|
@ -910,7 +910,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
|||||||
}
|
}
|
||||||
const char *insp = NULL;
|
const char *insp = NULL;
|
||||||
const char *after_insp = NULL;
|
const char *after_insp = NULL;
|
||||||
for (const char *entry = (const char *)p_rtp; *entry != NUL;) {
|
for (const char *entry = p_rtp; *entry != NUL;) {
|
||||||
const char *cur_entry = entry;
|
const char *cur_entry = entry;
|
||||||
|
|
||||||
copy_option_part((char **)&entry, buf, MAXPATHL, ",");
|
copy_option_part((char **)&entry, buf, MAXPATHL, ",");
|
||||||
@ -945,7 +945,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
|||||||
|
|
||||||
if (insp == NULL) {
|
if (insp == NULL) {
|
||||||
// Both "fname" and "after" not found, append at the end.
|
// Both "fname" and "after" not found, append at the end.
|
||||||
insp = (const char *)p_rtp + strlen(p_rtp);
|
insp = p_rtp + strlen(p_rtp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if rtp/pack/name/start/name/after exists
|
// check if rtp/pack/name/start/name/after exists
|
||||||
@ -966,7 +966,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
|||||||
|
|
||||||
// We now have 'rtp' parts: {keep}{keep_after}{rest}.
|
// We now have 'rtp' parts: {keep}{keep_after}{rest}.
|
||||||
// Create new_rtp, first: {keep},{fname}
|
// Create new_rtp, first: {keep},{fname}
|
||||||
size_t keep = (size_t)(insp - (const char *)p_rtp);
|
size_t keep = (size_t)(insp - p_rtp);
|
||||||
memmove(new_rtp, p_rtp, keep);
|
memmove(new_rtp, p_rtp, keep);
|
||||||
size_t new_rtp_len = keep;
|
size_t new_rtp_len = keep;
|
||||||
if (*insp == NUL) {
|
if (*insp == NUL) {
|
||||||
@ -979,7 +979,7 @@ static int add_pack_dir_to_rtp(char *fname, bool is_pack)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (afterlen > 0 && after_insp != NULL) {
|
if (afterlen > 0 && after_insp != NULL) {
|
||||||
size_t keep_after = (size_t)(after_insp - (const char *)p_rtp);
|
size_t keep_after = (size_t)(after_insp - p_rtp);
|
||||||
|
|
||||||
// Add to new_rtp: {keep},{fname}{keep_after},{afterdir}
|
// Add to new_rtp: {keep},{fname}{keep_after},{afterdir}
|
||||||
memmove(new_rtp + new_rtp_len, p_rtp + keep, keep_after - keep);
|
memmove(new_rtp + new_rtp_len, p_rtp + keep, keep_after - keep);
|
||||||
@ -1061,7 +1061,7 @@ static void add_pack_plugin(bool opt, char *fname, void *cookie)
|
|||||||
char *buf = xmalloc(MAXPATHL);
|
char *buf = xmalloc(MAXPATHL);
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
const char *p = (const char *)p_rtp;
|
const char *p = p_rtp;
|
||||||
while (*p != NUL) {
|
while (*p != NUL) {
|
||||||
copy_option_part((char **)&p, buf, MAXPATHL, ",");
|
copy_option_part((char **)&p, buf, MAXPATHL, ",");
|
||||||
if (path_fnamecmp(buf, fname) == 0) {
|
if (path_fnamecmp(buf, fname) == 0) {
|
||||||
@ -1925,12 +1925,10 @@ static void cmd_source_buffer(const exarg_T *const eap)
|
|||||||
.offset = 0,
|
.offset = 0,
|
||||||
};
|
};
|
||||||
if (curbuf->b_fname
|
if (curbuf->b_fname
|
||||||
&& path_with_extension((const char *)curbuf->b_fname, "lua")) {
|
&& path_with_extension(curbuf->b_fname, "lua")) {
|
||||||
nlua_source_using_linegetter(get_str_line, (void *)&cookie,
|
nlua_source_using_linegetter(get_str_line, (void *)&cookie, ":source (no file)");
|
||||||
":source (no file)");
|
|
||||||
} else {
|
} else {
|
||||||
source_using_linegetter((void *)&cookie, get_str_line,
|
source_using_linegetter((void *)&cookie, get_str_line, ":source (no file)");
|
||||||
":source (no file)");
|
|
||||||
}
|
}
|
||||||
ga_clear(&ga);
|
ga_clear(&ga);
|
||||||
}
|
}
|
||||||
@ -2134,12 +2132,12 @@ int do_source(char *fname, int check_other, int is_vimrc, int *ret_sid)
|
|||||||
|
|
||||||
cookie.conv.vc_type = CONV_NONE; // no conversion
|
cookie.conv.vc_type = CONV_NONE; // no conversion
|
||||||
|
|
||||||
if (path_with_extension((const char *)fname_exp, "lua")) {
|
if (path_with_extension(fname_exp, "lua")) {
|
||||||
const sctx_T current_sctx_backup = current_sctx;
|
const sctx_T current_sctx_backup = current_sctx;
|
||||||
current_sctx.sc_sid = SID_LUA;
|
current_sctx.sc_sid = SID_LUA;
|
||||||
current_sctx.sc_lnum = 0;
|
current_sctx.sc_lnum = 0;
|
||||||
// Source the file as lua
|
// Source the file as lua
|
||||||
nlua_exec_file((const char *)fname_exp);
|
nlua_exec_file(fname_exp);
|
||||||
current_sctx = current_sctx_backup;
|
current_sctx = current_sctx_backup;
|
||||||
} else {
|
} else {
|
||||||
// Read the first line so we can check for a UTF-8 BOM.
|
// Read the first line so we can check for a UTF-8 BOM.
|
||||||
|
@ -1468,7 +1468,7 @@ int search_for_exact_line(buf_T *buf, pos_T *pos, Direction dir, char *pat)
|
|||||||
// when adding lines the matching line may be empty but it is not
|
// when adding lines the matching line may be empty but it is not
|
||||||
// ignored because we are interested in the next line -- Acevedo
|
// ignored because we are interested in the next line -- Acevedo
|
||||||
if (compl_status_adding() && !compl_status_sol()) {
|
if (compl_status_adding() && !compl_status_sol()) {
|
||||||
if (mb_strcmp_ic((bool)p_ic, (const char *)p, (const char *)pat) == 0) {
|
if (mb_strcmp_ic((bool)p_ic, p, pat) == 0) {
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
} else if (*p != NUL) { // Ignore empty lines.
|
} else if (*p != NUL) { // Ignore empty lines.
|
||||||
@ -2777,21 +2777,21 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dict = argvars[0].vval.v_dict;
|
dict = argvars[0].vval.v_dict;
|
||||||
di = tv_dict_find(dict, (const char *)"timeout", -1);
|
di = tv_dict_find(dict, "timeout", -1);
|
||||||
if (di != NULL) {
|
if (di != NULL) {
|
||||||
timeout = (long)tv_get_number_chk(&di->di_tv, &error);
|
timeout = (long)tv_get_number_chk(&di->di_tv, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
di = tv_dict_find(dict, (const char *)"maxcount", -1);
|
di = tv_dict_find(dict, "maxcount", -1);
|
||||||
if (di != NULL) {
|
if (di != NULL) {
|
||||||
maxcount = (int)tv_get_number_chk(&di->di_tv, &error);
|
maxcount = (int)tv_get_number_chk(&di->di_tv, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
di = tv_dict_find(dict, (const char *)"recompute", -1);
|
di = tv_dict_find(dict, "recompute", -1);
|
||||||
if (di != NULL) {
|
if (di != NULL) {
|
||||||
recompute = tv_get_number_chk(&di->di_tv, &error);
|
recompute = tv_get_number_chk(&di->di_tv, &error);
|
||||||
if (error) {
|
if (error) {
|
||||||
@ -2805,7 +2805,7 @@ void f_searchcount(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
di = tv_dict_find(dict, (const char *)"pos", -1);
|
di = tv_dict_find(dict, "pos", -1);
|
||||||
if (di != NULL) {
|
if (di != NULL) {
|
||||||
if (di->di_tv.v_type != VAR_LIST) {
|
if (di->di_tv.v_type != VAR_LIST) {
|
||||||
semsg(_(e_invarg2), "pos");
|
semsg(_(e_invarg2), "pos");
|
||||||
@ -3227,7 +3227,7 @@ static void fuzzy_match_in_list(list_T *const l, char *const str, const bool mat
|
|||||||
// For a dict, either use the specified key to lookup the string or
|
// For a dict, either use the specified key to lookup the string or
|
||||||
// use the specified callback function to get the string.
|
// use the specified callback function to get the string.
|
||||||
if (key != NULL) {
|
if (key != NULL) {
|
||||||
itemstr = tv_dict_get_string(tv->vval.v_dict, (const char *)key, false);
|
itemstr = tv_dict_get_string(tv->vval.v_dict, key, false);
|
||||||
} else {
|
} else {
|
||||||
typval_T argv[2];
|
typval_T argv[2];
|
||||||
|
|
||||||
|
@ -1491,7 +1491,7 @@ static char *shada_filename(const char *file)
|
|||||||
// If shell is not performing them then they should be done in main.c
|
// If shell is not performing them then they should be done in main.c
|
||||||
// where arguments are parsed, *not here*.
|
// where arguments are parsed, *not here*.
|
||||||
expand_env((char *)file, &(NameBuff[0]), MAXPATHL);
|
expand_env((char *)file, &(NameBuff[0]), MAXPATHL);
|
||||||
file = (const char *)&(NameBuff[0]);
|
file = &(NameBuff[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return xstrdup(file);
|
return xstrdup(file);
|
||||||
@ -1548,9 +1548,9 @@ static ShaDaWriteResult shada_pack_entry(msgpack_packer *const packer, ShadaEntr
|
|||||||
if (!HASHITEM_EMPTY(hi)) { \
|
if (!HASHITEM_EMPTY(hi)) { \
|
||||||
todo--; \
|
todo--; \
|
||||||
dictitem_T *const di = TV_DICT_HI2DI(hi); \
|
dictitem_T *const di = TV_DICT_HI2DI(hi); \
|
||||||
const size_t key_len = strlen((const char *)hi->hi_key); \
|
const size_t key_len = strlen(hi->hi_key); \
|
||||||
msgpack_pack_str(spacker, key_len); \
|
msgpack_pack_str(spacker, key_len); \
|
||||||
msgpack_pack_str_body(spacker, (const char *)hi->hi_key, key_len); \
|
msgpack_pack_str_body(spacker, hi->hi_key, key_len); \
|
||||||
if (encode_vim_to_msgpack(spacker, &di->di_tv, \
|
if (encode_vim_to_msgpack(spacker, &di->di_tv, \
|
||||||
_("additional data of ShaDa " what)) \
|
_("additional data of ShaDa " what)) \
|
||||||
== FAIL) { \
|
== FAIL) { \
|
||||||
@ -2208,7 +2208,7 @@ static inline ShaDaWriteResult shada_read_when_writing(ShaDaReadDef *const sd_re
|
|||||||
shada_free_shada_entry(&entry);
|
shada_free_shada_entry(&entry);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
const char *const fname = (const char *)entry.data.filemark.fname;
|
const char *const fname = entry.data.filemark.fname;
|
||||||
khiter_t k;
|
khiter_t k;
|
||||||
int kh_ret;
|
int kh_ret;
|
||||||
k = kh_put(file_marks, &wms->file_marks, fname, &kh_ret);
|
k = kh_put(file_marks, &wms->file_marks, fname, &kh_ret);
|
||||||
@ -2714,17 +2714,17 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, ShaDaReadDef
|
|||||||
const char *fname;
|
const char *fname;
|
||||||
if (fm.fmark.fnum == 0) {
|
if (fm.fmark.fnum == 0) {
|
||||||
assert(fm.fname != NULL);
|
assert(fm.fname != NULL);
|
||||||
if (shada_removable((const char *)fm.fname)) {
|
if (shada_removable(fm.fname)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fname = (const char *)fm.fname;
|
fname = fm.fname;
|
||||||
} else {
|
} else {
|
||||||
const buf_T *const buf = buflist_findnr(fm.fmark.fnum);
|
const buf_T *const buf = buflist_findnr(fm.fmark.fnum);
|
||||||
if (buf == NULL || buf->b_ffname == NULL
|
if (buf == NULL || buf->b_ffname == NULL
|
||||||
|| in_bufset(&removable_bufs, buf)) {
|
|| in_bufset(&removable_bufs, buf)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
fname = (const char *)buf->b_ffname;
|
fname = buf->b_ffname;
|
||||||
}
|
}
|
||||||
const PossiblyFreedShadaEntry pf_entry = {
|
const PossiblyFreedShadaEntry pf_entry = {
|
||||||
.can_free_entry = false,
|
.can_free_entry = false,
|
||||||
@ -2761,7 +2761,7 @@ static ShaDaWriteResult shada_write(ShaDaWriteDef *const sd_writer, ShaDaReadDef
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const void *local_marks_iter = NULL;
|
const void *local_marks_iter = NULL;
|
||||||
const char *const fname = (const char *)buf->b_ffname;
|
const char *const fname = buf->b_ffname;
|
||||||
khiter_t k;
|
khiter_t k;
|
||||||
int kh_ret;
|
int kh_ret;
|
||||||
k = kh_put(file_marks, &wms->file_marks, fname, &kh_ret);
|
k = kh_put(file_marks, &wms->file_marks, fname, &kh_ret);
|
||||||
|
@ -1316,7 +1316,7 @@ size_t spell_move_to(win_T *wp, int dir, bool allwords, bool curline, hlf_T *att
|
|||||||
// Copy the line into "buf" and append the start of the next line if
|
// Copy the line into "buf" and append the start of the next line if
|
||||||
// possible. Note: this ml_get_buf() may make "line" invalid, check
|
// possible. Note: this ml_get_buf() may make "line" invalid, check
|
||||||
// for empty line first.
|
// for empty line first.
|
||||||
bool empty_line = *skipwhite((const char *)line) == NUL;
|
bool empty_line = *skipwhite(line) == NUL;
|
||||||
STRCPY(buf, line);
|
STRCPY(buf, line);
|
||||||
if (lnum < wp->w_buffer->b_ml.ml_line_count) {
|
if (lnum < wp->w_buffer->b_ml.ml_line_count) {
|
||||||
spell_cat_line(buf + strlen(buf),
|
spell_cat_line(buf + strlen(buf),
|
||||||
@ -1743,7 +1743,7 @@ void count_common_word(slang_T *lp, char *word, int len, uint8_t count)
|
|||||||
wordcount_T *wc;
|
wordcount_T *wc;
|
||||||
hash_T hash = hash_hash(p);
|
hash_T hash = hash_hash(p);
|
||||||
const size_t p_len = strlen(p);
|
const size_t p_len = strlen(p);
|
||||||
hashitem_T *hi = hash_lookup(&lp->sl_wordcount, (const char *)p, p_len, hash);
|
hashitem_T *hi = hash_lookup(&lp->sl_wordcount, p, p_len, hash);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
wc = xmalloc(offsetof(wordcount_T, wc_word) + p_len + 1);
|
wc = xmalloc(offsetof(wordcount_T, wc_word) + p_len + 1);
|
||||||
memcpy(wc->wc_word, p, p_len + 1);
|
memcpy(wc->wc_word, p, p_len + 1);
|
||||||
@ -3129,9 +3129,9 @@ void ex_spellinfo(exarg_T *eap)
|
|||||||
for (int lpi = 0; lpi < curwin->w_s->b_langp.ga_len && !got_int; lpi++) {
|
for (int lpi = 0; lpi < curwin->w_s->b_langp.ga_len && !got_int; lpi++) {
|
||||||
langp_T *const lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
langp_T *const lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
msg_puts("file: ");
|
msg_puts("file: ");
|
||||||
msg_puts((const char *)lp->lp_slang->sl_fname);
|
msg_puts(lp->lp_slang->sl_fname);
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
const char *const p = (const char *)lp->lp_slang->sl_info;
|
const char *const p = lp->lp_slang->sl_info;
|
||||||
if (p != NULL) {
|
if (p != NULL) {
|
||||||
msg_puts(p);
|
msg_puts(p);
|
||||||
msg_putchar('\n');
|
msg_putchar('\n');
|
||||||
|
@ -5712,7 +5712,7 @@ static void init_spellfile(void)
|
|||||||
((fname != NULL
|
((fname != NULL
|
||||||
&& strstr(path_tail(fname), ".ascii.") != NULL)
|
&& strstr(path_tail(fname), ".ascii.") != NULL)
|
||||||
? "ascii"
|
? "ascii"
|
||||||
: (const char *)spell_enc()));
|
: spell_enc()));
|
||||||
set_option_value_give_err("spellfile", 0L, buf, OPT_LOCAL);
|
set_option_value_give_err("spellfile", 0L, buf, OPT_LOCAL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -5851,7 +5851,7 @@ static void set_map_str(slang_T *lp, char *map)
|
|||||||
utf_char2bytes(headc, b + cl + 1);
|
utf_char2bytes(headc, b + cl + 1);
|
||||||
b[cl + 1 + headcl] = NUL;
|
b[cl + 1 + headcl] = NUL;
|
||||||
hash = hash_hash(b);
|
hash = hash_hash(b);
|
||||||
hi = hash_lookup(&lp->sl_map_hash, (const char *)b, strlen(b), hash);
|
hi = hash_lookup(&lp->sl_map_hash, b, strlen(b), hash);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
hash_add_item(&lp->sl_map_hash, hi, b, hash);
|
hash_add_item(&lp->sl_map_hash, hi, b, hash);
|
||||||
} else {
|
} else {
|
||||||
|
@ -2794,7 +2794,7 @@ static void add_sound_suggest(suginfo_T *su, char *goodword, int score, langp_T
|
|||||||
// remember the words that have been done.
|
// remember the words that have been done.
|
||||||
hash_T hash = hash_hash(goodword);
|
hash_T hash = hash_hash(goodword);
|
||||||
const size_t goodword_len = strlen(goodword);
|
const size_t goodword_len = strlen(goodword);
|
||||||
hashitem_T *hi = hash_lookup(&slang->sl_sounddone, (const char *)goodword, goodword_len, hash);
|
hashitem_T *hi = hash_lookup(&slang->sl_sounddone, goodword, goodword_len, hash);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
sft = xmalloc(offsetof(sftword_T, sft_word) + goodword_len + 1);
|
sft = xmalloc(offsetof(sftword_T, sft_word) + goodword_len + 1);
|
||||||
sft->sft_score = (int16_t)score;
|
sft->sft_score = (int16_t)score;
|
||||||
|
@ -1482,7 +1482,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
|
|||||||
// If the output of the expression needs to be evaluated
|
// If the output of the expression needs to be evaluated
|
||||||
// replace the %{} block with the result of evaluation
|
// replace the %{} block with the result of evaluation
|
||||||
if (reevaluate && str != NULL && *str != 0
|
if (reevaluate && str != NULL && *str != 0
|
||||||
&& strchr((const char *)str, '%') != NULL
|
&& strchr(str, '%') != NULL
|
||||||
&& evaldepth < MAX_STL_EVAL_DEPTH) {
|
&& evaldepth < MAX_STL_EVAL_DEPTH) {
|
||||||
size_t parsed_usefmt = (size_t)(block_start - usefmt);
|
size_t parsed_usefmt = (size_t)(block_start - usefmt);
|
||||||
size_t str_length = strlen(str);
|
size_t str_length = strlen(str);
|
||||||
|
@ -3749,7 +3749,7 @@ static void add_keyword(char *const name, const int id, const int flags,
|
|||||||
hashtab_T *const ht = (curwin->w_s->b_syn_ic)
|
hashtab_T *const ht = (curwin->w_s->b_syn_ic)
|
||||||
? &curwin->w_s->b_keywtab_ic
|
? &curwin->w_s->b_keywtab_ic
|
||||||
: &curwin->w_s->b_keywtab;
|
: &curwin->w_s->b_keywtab;
|
||||||
hashitem_T *const hi = hash_lookup(ht, (const char *)kp->keyword,
|
hashitem_T *const hi = hash_lookup(ht, kp->keyword,
|
||||||
strlen(kp->keyword), hash);
|
strlen(kp->keyword), hash);
|
||||||
|
|
||||||
// even though it looks like only the kp->keyword member is
|
// even though it looks like only the kp->keyword member is
|
||||||
@ -5370,7 +5370,7 @@ void set_context_in_syntax_cmd(expand_T *xp, const char *arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// (part of) subcommand already typed
|
// (part of) subcommand already typed
|
||||||
const char *p = (const char *)skiptowhite(arg);
|
const char *p = skiptowhite(arg);
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1081,7 +1081,7 @@ static int add_llist_tags(char *tag, int num_matches, char **matches)
|
|||||||
tv_list_append_dict(list, dict);
|
tv_list_append_dict(list, dict);
|
||||||
|
|
||||||
tv_dict_add_str(dict, S_LEN("text"), tag_name);
|
tv_dict_add_str(dict, S_LEN("text"), tag_name);
|
||||||
tv_dict_add_str(dict, S_LEN("filename"), (const char *)fname);
|
tv_dict_add_str(dict, S_LEN("filename"), fname);
|
||||||
tv_dict_add_nr(dict, S_LEN("lnum"), lnum);
|
tv_dict_add_nr(dict, S_LEN("lnum"), lnum);
|
||||||
if (lnum == 0) {
|
if (lnum == 0) {
|
||||||
tv_dict_add_str(dict, S_LEN("pattern"), cmd);
|
tv_dict_add_str(dict, S_LEN("pattern"), cmd);
|
||||||
@ -1246,10 +1246,10 @@ static int find_tagfunc_tags(char *pat, garray_T *ga, int *match_count, int flag
|
|||||||
// create 'info' dict argument
|
// create 'info' dict argument
|
||||||
dict_T *const d = tv_dict_alloc_lock(VAR_FIXED);
|
dict_T *const d = tv_dict_alloc_lock(VAR_FIXED);
|
||||||
if (tag != NULL && tag->user_data != NULL) {
|
if (tag != NULL && tag->user_data != NULL) {
|
||||||
tv_dict_add_str(d, S_LEN("user_data"), (const char *)tag->user_data);
|
tv_dict_add_str(d, S_LEN("user_data"), tag->user_data);
|
||||||
}
|
}
|
||||||
if (buf_ffname != NULL) {
|
if (buf_ffname != NULL) {
|
||||||
tv_dict_add_str(d, S_LEN("buf_ffname"), (const char *)buf_ffname);
|
tv_dict_add_str(d, S_LEN("buf_ffname"), buf_ffname);
|
||||||
}
|
}
|
||||||
|
|
||||||
d->dv_refcount++;
|
d->dv_refcount++;
|
||||||
@ -2067,7 +2067,7 @@ static void findtags_add_match(findtags_state_T *st, tagptrs_T *tagpp, findtags_
|
|||||||
// follow after it. E.g. help tags store the priority
|
// follow after it. E.g. help tags store the priority
|
||||||
// after the NUL.
|
// after the NUL.
|
||||||
*hash = hash_hash(mfp);
|
*hash = hash_hash(mfp);
|
||||||
hi = hash_lookup(&st->ht_match[mtt], (const char *)mfp, strlen(mfp), *hash);
|
hi = hash_lookup(&st->ht_match[mtt], mfp, strlen(mfp), *hash);
|
||||||
if (HASHITEM_EMPTY(hi)) {
|
if (HASHITEM_EMPTY(hi)) {
|
||||||
hash_add_item(&st->ht_match[mtt], hi, mfp, *hash);
|
hash_add_item(&st->ht_match[mtt], hi, mfp, *hash);
|
||||||
GA_APPEND(char *, &st->ga_match[mtt], mfp);
|
GA_APPEND(char *, &st->ga_match[mtt], mfp);
|
||||||
@ -3408,11 +3408,11 @@ static void get_tag_details(taggy_T *tag, dict_T *retdict)
|
|||||||
list_T *pos;
|
list_T *pos;
|
||||||
fmark_T *fmark;
|
fmark_T *fmark;
|
||||||
|
|
||||||
tv_dict_add_str(retdict, S_LEN("tagname"), (const char *)tag->tagname);
|
tv_dict_add_str(retdict, S_LEN("tagname"), tag->tagname);
|
||||||
tv_dict_add_nr(retdict, S_LEN("matchnr"), tag->cur_match + 1);
|
tv_dict_add_nr(retdict, S_LEN("matchnr"), tag->cur_match + 1);
|
||||||
tv_dict_add_nr(retdict, S_LEN("bufnr"), tag->cur_fnum);
|
tv_dict_add_nr(retdict, S_LEN("bufnr"), tag->cur_fnum);
|
||||||
if (tag->user_data) {
|
if (tag->user_data) {
|
||||||
tv_dict_add_str(retdict, S_LEN("user_data"), (const char *)tag->user_data);
|
tv_dict_add_str(retdict, S_LEN("user_data"), tag->user_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
pos = tv_list_alloc(4);
|
pos = tv_list_alloc(4);
|
||||||
|
@ -185,16 +185,14 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char *exp_str
|
|||||||
int todo = (int)exp_d->dv_hashtab.ht_used;
|
int todo = (int)exp_d->dv_hashtab.ht_used;
|
||||||
for (const hashitem_T *hi = exp_d->dv_hashtab.ht_array; todo > 0; hi++) {
|
for (const hashitem_T *hi = exp_d->dv_hashtab.ht_array; todo > 0; hi++) {
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (!HASHITEM_EMPTY(hi)) {
|
||||||
dictitem_T *item2 = tv_dict_find(got_d, (const char *)hi->hi_key, -1);
|
dictitem_T *item2 = tv_dict_find(got_d, hi->hi_key, -1);
|
||||||
if (item2 == NULL
|
if (item2 == NULL
|
||||||
|| !tv_equal(&TV_DICT_HI2DI(hi)->di_tv, &item2->di_tv, false, false)) {
|
|| !tv_equal(&TV_DICT_HI2DI(hi)->di_tv, &item2->di_tv, false, false)) {
|
||||||
// item of exp_d not present in got_d or values differ.
|
// item of exp_d not present in got_d or values differ.
|
||||||
const size_t key_len = strlen(hi->hi_key);
|
const size_t key_len = strlen(hi->hi_key);
|
||||||
tv_dict_add_tv(exp_tv->vval.v_dict, (const char *)hi->hi_key, key_len,
|
tv_dict_add_tv(exp_tv->vval.v_dict, hi->hi_key, key_len, &TV_DICT_HI2DI(hi)->di_tv);
|
||||||
&TV_DICT_HI2DI(hi)->di_tv);
|
|
||||||
if (item2 != NULL) {
|
if (item2 != NULL) {
|
||||||
tv_dict_add_tv(got_tv->vval.v_dict, (const char *)hi->hi_key, key_len,
|
tv_dict_add_tv(got_tv->vval.v_dict, hi->hi_key, key_len, &item2->di_tv);
|
||||||
&item2->di_tv);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
omitted++;
|
omitted++;
|
||||||
@ -207,12 +205,11 @@ static void fill_assert_error(garray_T *gap, typval_T *opt_msg_tv, char *exp_str
|
|||||||
todo = (int)got_d->dv_hashtab.ht_used;
|
todo = (int)got_d->dv_hashtab.ht_used;
|
||||||
for (const hashitem_T *hi = got_d->dv_hashtab.ht_array; todo > 0; hi++) {
|
for (const hashitem_T *hi = got_d->dv_hashtab.ht_array; todo > 0; hi++) {
|
||||||
if (!HASHITEM_EMPTY(hi)) {
|
if (!HASHITEM_EMPTY(hi)) {
|
||||||
dictitem_T *item2 = tv_dict_find(exp_d, (const char *)hi->hi_key, -1);
|
dictitem_T *item2 = tv_dict_find(exp_d, hi->hi_key, -1);
|
||||||
if (item2 == NULL) {
|
if (item2 == NULL) {
|
||||||
// item of got_d not present in exp_d
|
// item of got_d not present in exp_d
|
||||||
const size_t key_len = strlen(hi->hi_key);
|
const size_t key_len = strlen(hi->hi_key);
|
||||||
tv_dict_add_tv(got_tv->vval.v_dict, (const char *)hi->hi_key, key_len,
|
tv_dict_add_tv(got_tv->vval.v_dict, hi->hi_key, key_len, &TV_DICT_HI2DI(hi)->di_tv);
|
||||||
&TV_DICT_HI2DI(hi)->di_tv);
|
|
||||||
}
|
}
|
||||||
todo--;
|
todo--;
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ uint64_t ui_client_start_server(int argc, char **argv)
|
|||||||
varnumber_T exit_status;
|
varnumber_T exit_status;
|
||||||
char **args = xmalloc(((size_t)(2 + argc)) * sizeof(char *));
|
char **args = xmalloc(((size_t)(2 + argc)) * sizeof(char *));
|
||||||
int args_idx = 0;
|
int args_idx = 0;
|
||||||
args[args_idx++] = xstrdup((const char *)get_vim_var_str(VV_PROGPATH));
|
args[args_idx++] = xstrdup(get_vim_var_str(VV_PROGPATH));
|
||||||
args[args_idx++] = xstrdup("--embed");
|
args[args_idx++] = xstrdup("--embed");
|
||||||
for (int i = 1; i < argc; i++) {
|
for (int i = 1; i < argc; i++) {
|
||||||
args[args_idx++] = xstrdup(argv[i]);
|
args[args_idx++] = xstrdup(argv[i]);
|
||||||
|
@ -1179,7 +1179,7 @@ void u_write_undo(const char *const name, const bool forceit, buf_T *const buf,
|
|||||||
// allow the user to access the undo file.
|
// allow the user to access the undo file.
|
||||||
int perm = 0600;
|
int perm = 0600;
|
||||||
if (buf->b_ffname != NULL) {
|
if (buf->b_ffname != NULL) {
|
||||||
perm = os_getperm((const char *)buf->b_ffname);
|
perm = os_getperm(buf->b_ffname);
|
||||||
if (perm < 0) {
|
if (perm < 0) {
|
||||||
perm = 0600;
|
perm = 0600;
|
||||||
}
|
}
|
||||||
|
@ -234,7 +234,7 @@ const char *set_context_in_user_cmd(expand_T *xp, const char *arg_in)
|
|||||||
// Check for attributes
|
// Check for attributes
|
||||||
while (*arg == '-') {
|
while (*arg == '-') {
|
||||||
arg++; // Skip "-".
|
arg++; // Skip "-".
|
||||||
p = (const char *)skiptowhite(arg);
|
p = skiptowhite(arg);
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
// Cursor is still in the attribute.
|
// Cursor is still in the attribute.
|
||||||
p = strchr(arg, '=');
|
p = strchr(arg, '=');
|
||||||
@ -262,11 +262,11 @@ const char *set_context_in_user_cmd(expand_T *xp, const char *arg_in)
|
|||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
arg = (const char *)skipwhite(p);
|
arg = skipwhite(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
// After the attributes comes the new command name.
|
// After the attributes comes the new command name.
|
||||||
p = (const char *)skiptowhite(arg);
|
p = skiptowhite(arg);
|
||||||
if (*p == NUL) {
|
if (*p == NUL) {
|
||||||
xp->xp_context = EXPAND_USER_COMMANDS;
|
xp->xp_context = EXPAND_USER_COMMANDS;
|
||||||
xp->xp_pattern = (char *)arg;
|
xp->xp_pattern = (char *)arg;
|
||||||
@ -274,7 +274,7 @@ const char *set_context_in_user_cmd(expand_T *xp, const char *arg_in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// And finally comes a normal command.
|
// And finally comes a normal command.
|
||||||
return (const char *)skipwhite(p);
|
return skipwhite(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Set the completion context for the argument of a user defined command.
|
/// Set the completion context for the argument of a user defined command.
|
||||||
@ -292,7 +292,7 @@ const char *set_context_in_user_cmdarg(const char *cmd FUNC_ATTR_UNUSED, const c
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (context == EXPAND_MENUS) {
|
if (context == EXPAND_MENUS) {
|
||||||
return (const char *)set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
|
return set_context_in_menu_cmd(xp, cmd, (char *)arg, forceit);
|
||||||
}
|
}
|
||||||
if (context == EXPAND_COMMANDS) {
|
if (context == EXPAND_COMMANDS) {
|
||||||
return arg;
|
return arg;
|
||||||
|
@ -899,7 +899,7 @@ void win_check_anchored_floats(win_T *win)
|
|||||||
/// Return the number of fold columns to display
|
/// Return the number of fold columns to display
|
||||||
int win_fdccol_count(win_T *wp)
|
int win_fdccol_count(win_T *wp)
|
||||||
{
|
{
|
||||||
const char *fdc = (const char *)wp->w_p_fdc;
|
const char *fdc = wp->w_p_fdc;
|
||||||
|
|
||||||
// auto:<NUM>
|
// auto:<NUM>
|
||||||
if (strncmp(fdc, "auto", 4) == 0) {
|
if (strncmp(fdc, "auto", 4) == 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user