refactor: replace char_u with char 19 (#21241)

* refactor: replace char_u with char

Work on https://github.com/neovim/neovim/issues/459
This commit is contained in:
dundargoc
2023-01-10 03:28:01 +01:00
committed by GitHub
parent f62da7381e
commit ef67503320
14 changed files with 499 additions and 505 deletions

View File

@@ -458,12 +458,12 @@ static void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int m
s += skip_wildmenu_char(xp, (char_u *)s);
clen += ptr2cells(s);
if ((l = utfc_ptr2len(s)) > 1) {
strncpy((char *)buf + len, s, (size_t)l); // NOLINT(runtime/printf)
strncpy(buf + len, s, (size_t)l); // NOLINT(runtime/printf)
s += l - 1;
len += l;
} else {
STRCPY(buf + len, transchar_byte((uint8_t)(*s)));
len += (int)strlen((char *)buf + len);
len += (int)strlen(buf + len);
}
}
}

View File

@@ -3100,7 +3100,7 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
} else if (*look == ':') {
if (try_match && keytyped == ':') {
p = get_cursor_line_ptr();
if (cin_iscase((char_u *)p, false) || cin_isscopedecl((char_u *)p) || cin_islabel()) {
if (cin_iscase(p, false) || cin_isscopedecl(p) || cin_islabel()) {
return true;
}
// Need to get the line again after cin_islabel().
@@ -3109,8 +3109,8 @@ bool in_cinkeys(int keytyped, int when, bool line_is_empty)
&& p[curwin->w_cursor.col - 1] == ':'
&& p[curwin->w_cursor.col - 2] == ':') {
p[curwin->w_cursor.col - 1] = ' ';
const bool i = cin_iscase((char_u *)p, false)
|| cin_isscopedecl((char_u *)p)
const bool i = cin_iscase(p, false)
|| cin_isscopedecl(p)
|| cin_islabel();
p = get_cursor_line_ptr();
p[curwin->w_cursor.col - 1] = ':';

View File

@@ -8007,7 +8007,7 @@ repeat:
s++;
}
int sep = (char_u)(*s++);
int sep = (uint8_t)(*s++);
if (sep) {
// find end of pattern
p = vim_strchr(s, sep);
@@ -8040,7 +8040,7 @@ repeat:
if (src[*usedlen] == ':' && src[*usedlen + 1] == 'S') {
// vim_strsave_shellescape() needs a NUL terminated string.
c = (char_u)(*fnamep)[*fnamelen];
c = (uint8_t)(*fnamep)[*fnamelen];
if (c != NUL) {
(*fnamep)[*fnamelen] = NUL;
}

View File

@@ -226,11 +226,11 @@ const EvalFuncDef *find_internal_func(const char *const name)
return index >= 0 ? &functions[index] : NULL;
}
int call_internal_func(const char_u *const fname, const int argcount, typval_T *const argvars,
int call_internal_func(const char *const fname, const int argcount, typval_T *const argvars,
typval_T *const rettv)
FUNC_ATTR_NONNULL_ALL
{
const EvalFuncDef *const fdef = find_internal_func((const char *)fname);
const EvalFuncDef *const fdef = find_internal_func(fname);
if (fdef == NULL) {
return FCERR_UNKNOWN;
} else if (argcount < fdef->min_argc) {
@@ -2751,19 +2751,19 @@ static void f_getpos(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
/// Returns zero on error.
static int getreg_get_regname(typval_T *argvars)
{
const char_u *strregname;
const char *strregname;
if (argvars[0].v_type != VAR_UNKNOWN) {
strregname = (const char_u *)tv_get_string_chk(&argvars[0]);
strregname = tv_get_string_chk(&argvars[0]);
if (strregname == NULL) { // type error; errmsg already given
return 0;
}
} else {
// Default to v:register
strregname = (char_u *)get_vim_var_str(VV_REG);
strregname = get_vim_var_str(VV_REG);
}
return *strregname == 0 ? '"' : *strregname;
return *strregname == 0 ? '"' : (uint8_t)(*strregname);
}
/// "getreg()" function
@@ -3365,13 +3365,11 @@ static void f_iconv(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
const char *const str = tv_get_string(&argvars[0]);
char buf1[NUMBUFLEN];
char_u *const from =
(char_u *)enc_canonize(enc_skip((char *)tv_get_string_buf(&argvars[1], buf1)));
char *const from = enc_canonize(enc_skip((char *)tv_get_string_buf(&argvars[1], buf1)));
char buf2[NUMBUFLEN];
char_u *const to =
(char_u *)enc_canonize(enc_skip((char *)tv_get_string_buf(&argvars[2], buf2)));
char *const to = enc_canonize(enc_skip((char *)tv_get_string_buf(&argvars[2], buf2)));
vimconv.vc_type = CONV_NONE;
convert_setup(&vimconv, (char *)from, (char *)to);
convert_setup(&vimconv, from, to);
// If the encodings are equal, no conversion needed.
if (vimconv.vc_type == CONV_NONE) {
@@ -3646,7 +3644,7 @@ static void f_islocked(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
lval_T lv;
rettv->vval.v_number = -1;
const char_u *const end = (char_u *)get_lval((char *)tv_get_string(&argvars[0]),
const char *const end = get_lval((char *)tv_get_string(&argvars[0]),
NULL,
&lv, false, false,
GLV_NO_AUTOLOAD|GLV_READ_ONLY,

View File

@@ -1618,7 +1618,7 @@ int call_func(const char *funcname, int len, typval_T *rettv, int argcount_in, t
funcexe->fe_basetv);
} else {
// Find the function name in the table, call its implementation.
error = call_internal_func((char_u *)fname, argcount, argvars, rettv);
error = call_internal_func(fname, argcount, argvars, rettv);
}
// The function call (or "FuncUndefined" autocommand sequence) might
// have been aborted by an error, an interrupt, or an explicitly thrown

View File

@@ -215,22 +215,22 @@ static int ses_do_win(win_T *wp)
/// @returns FAIL if writing fails.
static int ses_arglist(FILE *fd, char *cmd, garray_T *gap, int fullname, unsigned *flagp)
{
char_u *buf = NULL;
char_u *s;
char *buf = NULL;
char *s;
if (fprintf(fd, "%s\n%s\n", cmd, "%argdel") < 0) {
return FAIL;
}
for (int i = 0; i < gap->ga_len; i++) {
// NULL file names are skipped (only happens when out of memory).
s = (char_u *)alist_name(&((aentry_T *)gap->ga_data)[i]);
s = alist_name(&((aentry_T *)gap->ga_data)[i]);
if (s != NULL) {
if (fullname) {
buf = xmalloc(MAXPATHL);
(void)vim_FullName((char *)s, (char *)buf, MAXPATHL, false);
(void)vim_FullName(s, buf, MAXPATHL, false);
s = buf;
}
char *fname_esc = ses_escape_fname((char *)s, flagp);
char *fname_esc = ses_escape_fname(s, flagp);
if (fprintf(fd, "$argadd %s\n", fname_esc) < 0) {
xfree(fname_esc);
xfree(buf);
@@ -268,7 +268,7 @@ static char *ses_get_fname(buf_T *buf, const unsigned *flagp)
static int ses_fname(FILE *fd, buf_T *buf, unsigned *flagp, bool add_eol)
{
char *name = ses_get_fname(buf, flagp);
if (ses_put_fname(fd, (char_u *)name, flagp) == FAIL
if (ses_put_fname(fd, name, flagp) == FAIL
|| (add_eol && fprintf(fd, "\n") < 0)) {
return FAIL;
}
@@ -303,9 +303,9 @@ static char *ses_escape_fname(char *name, unsigned *flagp)
/// characters.
///
/// @return FAIL if writing fails.
static int ses_put_fname(FILE *fd, char_u *name, unsigned *flagp)
static int ses_put_fname(FILE *fd, char *name, unsigned *flagp)
{
char *p = ses_escape_fname((char *)name, flagp);
char *p = ses_escape_fname(name, flagp);
bool retval = fputs(p, fd) < 0 ? FAIL : OK;
xfree(p);
return retval;
@@ -527,7 +527,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
if (wp->w_localdir != NULL
&& (flagp != &vop_flags || (*flagp & SSOP_CURDIR))) {
if (fputs("lcd ", fd) < 0
|| ses_put_fname(fd, (char_u *)wp->w_localdir, flagp) == FAIL
|| ses_put_fname(fd, wp->w_localdir, flagp) == FAIL
|| fprintf(fd, "\n") < 0) {
return FAIL;
}
@@ -546,7 +546,7 @@ static int put_view(FILE *fd, win_T *wp, int add_edit, unsigned *flagp, int curr
/// @param fd File descriptor to write to
///
/// @return FAIL on error, OK otherwise.
static int makeopens(FILE *fd, char_u *dirnow)
static int makeopens(FILE *fd, char *dirnow)
{
int only_save_windows = true;
int nr;
@@ -585,7 +585,7 @@ static int makeopens(FILE *fd, char_u *dirnow)
if (ssop_flags & SSOP_SESDIR) {
PUTLINE_FAIL("exe \"cd \" . escape(expand(\"<sfile>:p:h\"), ' ')");
} else if (ssop_flags & SSOP_CURDIR) {
sname = home_replace_save(NULL, globaldir != NULL ? globaldir : (char *)dirnow);
sname = home_replace_save(NULL, globaldir != NULL ? globaldir : dirnow);
char *fname_esc = ses_escape_fname(sname, &ssop_flags);
if (fprintf(fd, "cd %s\n", fname_esc) < 0) {
xfree(fname_esc);
@@ -832,7 +832,7 @@ static int makeopens(FILE *fd, char_u *dirnow)
// Take care of tab-local working directories if applicable
if (tp->tp_localdir) {
if (fputs("if exists(':tcd') == 2 | tcd ", fd) < 0
|| ses_put_fname(fd, (char_u *)tp->tp_localdir, &ssop_flags) == FAIL
|| ses_put_fname(fd, tp->tp_localdir, &ssop_flags) == FAIL
|| fputs(" | endif\n", fd) < 0) {
return FAIL;
}
@@ -1001,14 +1001,14 @@ void ex_mkrc(exarg_T *eap)
failed = true;
}
if (eap->cmdidx == CMD_mksession) {
char_u *dirnow; // current directory
char *dirnow; // current directory
dirnow = xmalloc(MAXPATHL);
//
// Change to session file's dir.
//
if (os_dirname((char *)dirnow, MAXPATHL) == FAIL
|| os_chdir((char *)dirnow) != 0) {
if (os_dirname(dirnow, MAXPATHL) == FAIL
|| os_chdir(dirnow) != 0) {
*dirnow = NUL;
}
if (*dirnow != NUL && (ssop_flags & SSOP_SESDIR)) {
@@ -1028,7 +1028,7 @@ void ex_mkrc(exarg_T *eap)
if (*dirnow != NUL && ((ssop_flags & SSOP_SESDIR)
|| ((ssop_flags & SSOP_CURDIR) && globaldir !=
NULL))) {
if (os_chdir((char *)dirnow) != 0) {
if (os_chdir(dirnow) != 0) {
emsg(_(e_prev_dir));
}
shorten_fnames(true);

File diff suppressed because it is too large Load Diff

View File

@@ -683,7 +683,7 @@ static void fname2fnum(xfmark_T *fm)
// Used for marks that come from the .shada file.
void fmarks_check_names(buf_T *buf)
{
char_u *name = (char_u *)buf->b_ffname;
char *name = buf->b_ffname;
int i;
if (buf->b_ffname == NULL) {
@@ -691,12 +691,12 @@ void fmarks_check_names(buf_T *buf)
}
for (i = 0; i < NGLOBALMARKS; i++) {
fmarks_check_one(&namedfm[i], (char *)name, buf);
fmarks_check_one(&namedfm[i], name, buf);
}
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
for (i = 0; i < wp->w_jumplistlen; i++) {
fmarks_check_one(&wp->w_jumplist[i], (char *)name, buf);
fmarks_check_one(&wp->w_jumplist[i], name, buf);
}
}
}
@@ -781,12 +781,12 @@ void clrallmarks(buf_T *const buf)
// Get name of file from a filemark.
// When it's in the current buffer, return the text at the mark.
// Returns an allocated string.
char_u *fm_getname(fmark_T *fmark, int lead_len)
char *fm_getname(fmark_T *fmark, int lead_len)
{
if (fmark->fnum == curbuf->b_fnum) { // current buffer
return (char_u *)mark_line(&(fmark->mark), lead_len);
return mark_line(&(fmark->mark), lead_len);
}
return (char_u *)buflist_nr2name(fmark->fnum, false, true);
return buflist_nr2name(fmark->fnum, false, true);
}
/// Return the line at mark "mp". Truncate to fit in window.
@@ -818,9 +818,9 @@ static char *mark_line(pos_T *mp, int lead_len)
// print the marks
void ex_marks(exarg_T *eap)
{
char_u *arg = (char_u *)eap->arg;
char *arg = eap->arg;
int i;
char_u *name;
char *name;
pos_T *posp, *startp, *endp;
if (arg != NULL && *arg == NUL) {
@@ -833,9 +833,9 @@ void ex_marks(exarg_T *eap)
}
for (i = 0; i < NGLOBALMARKS; i++) {
if (namedfm[i].fmark.fnum != 0) {
name = fm_getname(&namedfm[i].fmark, 15);
name = (char *)fm_getname(&namedfm[i].fmark, 15);
} else {
name = (char_u *)namedfm[i].fname;
name = namedfm[i].fname;
}
if (name != NULL) {
show_one_mark(i >= NMARKS ? i - NMARKS + '0' : i + 'A',
@@ -867,11 +867,11 @@ void ex_marks(exarg_T *eap)
}
/// @param current in current file
static void show_one_mark(int c, char_u *arg, pos_T *p, char_u *name_arg, int current)
static void show_one_mark(int c, char *arg, pos_T *p, char *name_arg, int current)
{
static bool did_title = false;
bool mustfree = false;
char_u *name = name_arg;
char *name = name_arg;
if (c == -1) { // finish up
if (did_title) {
@@ -884,14 +884,14 @@ static void show_one_mark(int c, char_u *arg, pos_T *p, char_u *name_arg, int cu
}
}
} else if (!got_int
&& (arg == NULL || vim_strchr((char *)arg, c) != NULL)
&& (arg == NULL || vim_strchr(arg, c) != NULL)
&& p->lnum != 0) {
// don't output anything if 'q' typed at --more-- prompt
if (name == NULL && current) {
name = (char_u *)mark_line(p, 15);
name = mark_line(p, 15);
mustfree = true;
}
if (!message_filtered((char *)name)) {
if (!message_filtered(name)) {
if (!did_title) {
// Highlight title
msg_puts_title(_("\nmark line col file/text"));
@@ -902,7 +902,7 @@ static void show_one_mark(int c, char_u *arg, pos_T *p, char_u *name_arg, int cu
snprintf(IObuff, IOSIZE, " %c %6" PRIdLINENR " %4d ", c, p->lnum, p->col);
msg_outtrans(IObuff);
if (name != NULL) {
msg_outtrans_attr((char *)name, current ? HL_ATTR(HLF_D) : 0);
msg_outtrans_attr(name, current ? HL_ATTR(HLF_D) : 0);
}
}
}
@@ -1050,7 +1050,7 @@ void ex_clearjumps(exarg_T *eap)
void ex_changes(exarg_T *eap)
{
int i;
char_u *name;
char *name;
// Highlight title
msg_puts_title(_("\nchange line col text"));
@@ -1067,8 +1067,8 @@ void ex_changes(exarg_T *eap)
(long)curbuf->b_changelist[i].mark.lnum,
curbuf->b_changelist[i].mark.col);
msg_outtrans(IObuff);
name = (char_u *)mark_line(&curbuf->b_changelist[i].mark, 17);
msg_outtrans_attr((char *)name, HL_ATTR(HLF_D));
name = mark_line(&curbuf->b_changelist[i].mark, 17);
msg_outtrans_attr(name, HL_ATTR(HLF_D));
xfree(name);
os_breakcheck();
}

View File

@@ -335,7 +335,7 @@ static void shift_block(oparg_T *oap, int amount)
{
const bool left = (oap->op_type == OP_LSHIFT);
const int oldstate = State;
char_u *newp;
char *newp;
const int oldcol = curwin->w_cursor.col;
const int sw_val = (int)get_sw_value_indent(curbuf);
const int ts_val = (int)curbuf->b_p_ts;
@@ -406,7 +406,7 @@ static void shift_block(oparg_T *oap, int amount)
const int len = (int)strlen(bd.textstart) + 1;
int col = bd.textcol + i + j + len;
assert(col >= 0);
newp = (char_u *)xmalloc((size_t)col);
newp = xmalloc((size_t)col);
memset(newp, NUL, (size_t)col);
memmove(newp, oldp, (size_t)bd.textcol);
startcol = bd.textcol;
@@ -502,7 +502,7 @@ static void shift_block(oparg_T *oap, int amount)
// - the rest of the line, pointed to by non_white.
new_line_len = verbatim_diff + fill + strlen(non_white) + 1;
newp = (char_u *)xmalloc(new_line_len);
newp = xmalloc(new_line_len);
startcol = (int)verbatim_diff;
oldlen = bd.textcol + (int)(non_white - bd.textstart) - (int)verbatim_diff;
newlen = (int)fill;
@@ -511,7 +511,7 @@ static void shift_block(oparg_T *oap, int amount)
STRMOVE(newp + verbatim_diff + fill, non_white);
}
// replace the line
ml_replace(curwin->w_cursor.lnum, (char *)newp, false);
ml_replace(curwin->w_cursor.lnum, newp, false);
changed_bytes(curwin->w_cursor.lnum, bd.textcol);
extmark_splice_cols(curbuf, (int)curwin->w_cursor.lnum - 1, startcol,
oldlen, newlen,
@@ -636,7 +636,7 @@ static void block_insert(oparg_T *oap, char *s, int b_insert, struct block_def *
void op_reindent(oparg_T *oap, Indenter how)
{
long i = 0;
char_u *l;
char *l;
int amount;
linenr_T first_changed = 0;
linenr_T last_changed = 0;
@@ -666,7 +666,7 @@ void op_reindent(oparg_T *oap, Indenter how)
// indented, unless there is only one line.
if (i != oap->line_count - 1 || oap->line_count == 1
|| how != get_lisp_indent) {
l = (char_u *)skipwhite(get_cursor_line_ptr());
l = skipwhite(get_cursor_line_ptr());
if (*l == NUL) { // empty or blank line
amount = 0;
} else {
@@ -721,16 +721,16 @@ static char *expr_line = NULL;
/// @return '=' when OK, NUL otherwise.
int get_expr_register(void)
{
char_u *new_line;
char *new_line;
new_line = getcmdline('=', 0L, 0, true);
new_line = (char *)getcmdline('=', 0L, 0, true);
if (new_line == NULL) {
return NUL;
}
if (*new_line == NUL) { // use previous line
xfree(new_line);
} else {
set_expr_line((char *)new_line);
set_expr_line(new_line);
}
return '=';
}
@@ -902,7 +902,7 @@ bool yank_register_mline(int regname)
/// @return FAIL for failure, OK otherwise.
int do_record(int c)
{
char_u *p;
char *p;
static int regname;
yankreg_T *old_y_previous;
int retval;
@@ -927,10 +927,10 @@ int do_record(int c)
dict_T *dict = get_v_event(&save_v_event);
// The recorded text contents.
p = get_recorded();
p = (char *)get_recorded();
if (p != NULL) {
// Remove escaping for K_SPECIAL in multi-byte chars.
vim_unescape_ks(p);
vim_unescape_ks((char_u *)p);
(void)tv_dict_add_str(dict, S_LEN("regcontents"), (const char *)p);
}
@@ -960,7 +960,7 @@ int do_record(int c)
// restore the current register name.
old_y_previous = y_previous;
retval = stuff_yank(regname, (char *)p);
retval = stuff_yank(regname, p);
y_previous = old_y_previous;
}
@@ -996,13 +996,13 @@ static int stuff_yank(int regname, char *p)
yankreg_T *reg = get_yank_register(regname, YREG_YANK);
if (is_append_register(regname) && reg->y_array != NULL) {
char **pp = &(reg->y_array[reg->y_size - 1]);
char_u *lp = xmalloc(strlen(*pp) + strlen(p) + 1);
char *lp = xmalloc(strlen(*pp) + strlen(p) + 1);
STRCPY(lp, *pp);
// TODO(philix): use xstpcpy() in stuff_yank()
STRCAT(lp, p);
xfree(p);
xfree(*pp);
*pp = (char *)lp;
*pp = lp;
} else {
free_register(reg);
set_yreg_additional_data(reg, NULL);
@@ -1037,13 +1037,13 @@ static char_u *execreg_line_continuation(char **lines, size_t *idx)
garray_T ga;
ga_init(&ga, (int)sizeof(char_u), 400);
char_u *p;
char *p;
// search backwards to find the first line of this command.
// Any line not starting with \ or "\ is the start of the
// command.
while (--i > 0) {
p = (char_u *)skipwhite(lines[i]);
p = skipwhite(lines[i]);
if (*p != '\\' && (p[0] != '"' || p[1] != '\\' || p[2] != ' ')) {
break;
}
@@ -1053,14 +1053,14 @@ static char_u *execreg_line_continuation(char **lines, size_t *idx)
// join all the lines
ga_concat(&ga, lines[cmd_start]);
for (size_t j = cmd_start + 1; j <= cmd_end; j++) {
p = (char_u *)skipwhite(lines[j]);
p = skipwhite(lines[j]);
if (*p == '\\') {
// Adjust the growsize to the current length to
// speed up concatenating many lines.
if (ga.ga_len > 400) {
ga_set_growsize(&ga, MIN(ga.ga_len, 8000));
}
ga_concat(&ga, (char *)(p + 1));
ga_concat(&ga, p + 1);
}
}
ga_append(&ga, NUL);
@@ -1159,16 +1159,16 @@ int do_execreg(int regname, int colon, int addcr, int silent)
}
// Handle line-continuation for :@<register>
char_u *str = (char_u *)reg->y_array[i];
char *str = reg->y_array[i];
bool free_str = false;
if (colon && i > 0) {
p = skipwhite((char *)str);
p = skipwhite(str);
if (*p == '\\' || (p[0] == '"' && p[1] == '\\' && p[2] == ' ')) {
str = execreg_line_continuation(reg->y_array, &i);
str = (char *)execreg_line_continuation(reg->y_array, &i);
free_str = true;
}
}
escaped = vim_strsave_escape_ks((char *)str);
escaped = vim_strsave_escape_ks(str);
if (free_str) {
xfree(str);
}
@@ -1822,7 +1822,7 @@ static int op_replace(oparg_T *oap, int c)
char *newp, *oldp;
colnr_T oldlen;
struct block_def bd;
char_u *after_p = NULL;
char *after_p = NULL;
int had_ctrl_v_cr = false;
if ((curbuf->b_ml.ml_flags & ML_EMPTY) || oap->empty) {
@@ -1934,7 +1934,7 @@ static int op_replace(oparg_T *oap, int c)
} else {
// Replacing with \r or \n means splitting the line.
after_p_len = (size_t)col;
after_p = (char_u *)xmalloc(after_p_len);
after_p = xmalloc(after_p_len);
memmove(after_p, oldp, after_p_len);
newrows = 1;
}
@@ -1943,7 +1943,7 @@ static int op_replace(oparg_T *oap, int c)
curbuf_splice_pending++;
linenr_T baselnum = curwin->w_cursor.lnum;
if (after_p != NULL) {
ml_append(curwin->w_cursor.lnum++, (char *)after_p, (int)after_p_len, false);
ml_append(curwin->w_cursor.lnum++, after_p, (int)after_p_len, false);
appended_lines_mark(curwin->w_cursor.lnum, 1L);
oap->end.lnum++;
xfree(after_p);
@@ -2438,7 +2438,7 @@ int op_change(oparg_T *oap)
long ins_len;
long pre_textlen = 0;
long pre_indent = 0;
char_u *newp;
char *newp;
char *firstline;
char *ins_text;
char *oldp;
@@ -2538,7 +2538,7 @@ int op_change(oparg_T *oap)
offset += ins_len;
oldp += bd.textcol;
STRMOVE(newp + offset, oldp);
ml_replace(linenr, (char *)newp, false);
ml_replace(linenr, newp, false);
extmark_splice_cols(curbuf, (int)linenr - 1, bd.textcol,
0, vpos.coladd + (int)ins_len, kExtmarkUndo);
}
@@ -2619,7 +2619,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
size_t yanklines = (size_t)oap->line_count;
linenr_T yankendlnum = oap->end.lnum;
char *p;
char_u *pnew;
char *pnew;
struct block_def bd;
yankreg_T *curr = reg; // copy of current register
@@ -2760,7 +2760,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
STRCAT(pnew, reg->y_array[0]);
xfree(curr->y_array[j]);
xfree(reg->y_array[0]);
curr->y_array[j++] = (char *)pnew;
curr->y_array[j++] = pnew;
y_idx = 1;
} else {
y_idx = 0;
@@ -2826,8 +2826,8 @@ static void yank_copy_line(yankreg_T *reg, struct block_def *bd, size_t y_idx,
}
int size = bd->startspaces + bd->endspaces + bd->textlen;
assert(size >= 0);
char_u *pnew = xmallocz((size_t)size);
reg->y_array[y_idx] = (char *)pnew;
char *pnew = xmallocz((size_t)size);
reg->y_array[y_idx] = pnew;
memset(pnew, ' ', (size_t)bd->startspaces);
pnew += bd->startspaces;
memmove(pnew, bd->textstart, (size_t)bd->textlen);
@@ -3007,11 +3007,11 @@ void do_put(int regname, yankreg_T *reg, int dir, long count, int flags)
// strlen(ml_get(curwin->w_cursor.lnum)). With 'virtualedit' and the
// cursor past the end of the line, curwin->w_cursor.coladd is
// incremented instead of curwin->w_cursor.col.
char_u *cursor_pos = (char_u *)get_cursor_pos_ptr();
char *cursor_pos = get_cursor_pos_ptr();
bool one_past_line = (*cursor_pos == NUL);
bool eol = false;
if (!one_past_line) {
eol = (*(cursor_pos + utfc_ptr2len((char *)cursor_pos)) == NUL);
eol = (*(cursor_pos + utfc_ptr2len(cursor_pos)) == NUL);
}
bool ve_allows = (cur_ve_flags == VE_ALL || cur_ve_flags == VE_ONEMORE);
@@ -3763,10 +3763,10 @@ int get_unname_register(void)
/// ":dis" and ":registers": Display the contents of the yank registers.
void ex_display(exarg_T *eap)
{
char_u *p;
char *p;
yankreg_T *yb;
int name;
char_u *arg = (char_u *)eap->arg;
char *arg = eap->arg;
int clen;
int type;
@@ -3788,7 +3788,7 @@ void ex_display(exarg_T *eap)
type = 'b'; break;
}
if (arg != NULL && vim_strchr((char *)arg, name) == NULL) {
if (arg != NULL && vim_strchr(arg, name) == NULL) {
continue; // did not ask for this register
}
@@ -3832,10 +3832,10 @@ void ex_display(exarg_T *eap)
msg_puts_attr("^J", attr);
n -= 2;
}
for (p = (char_u *)yb->y_array[j];
*p != NUL && (n -= ptr2cells((char *)p)) >= 0; p++) { // -V1019
clen = utfc_ptr2len((char *)p);
msg_outtrans_len((char *)p, clen);
for (p = yb->y_array[j];
*p != NUL && (n -= ptr2cells(p)) >= 0; p++) { // -V1019
clen = utfc_ptr2len(p);
msg_outtrans_len(p, clen);
p += clen - 1;
}
}
@@ -3848,15 +3848,15 @@ void ex_display(exarg_T *eap)
}
// display last inserted text
if ((p = get_last_insert()) != NULL
&& (arg == NULL || vim_strchr((char *)arg, '.') != NULL) && !got_int
&& !message_filtered((char *)p)) {
if ((p = (char *)get_last_insert()) != NULL
&& (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int
&& !message_filtered(p)) {
msg_puts("\n c \". ");
dis_msg((char *)p, true);
dis_msg(p, true);
}
// display last command line
if (last_cmdline != NULL && (arg == NULL || vim_strchr((char *)arg, ':') != NULL)
if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL)
&& !got_int && !message_filtered(last_cmdline)) {
msg_puts("\n c \": ");
dis_msg(last_cmdline, false);
@@ -3864,14 +3864,14 @@ void ex_display(exarg_T *eap)
// display current file name
if (curbuf->b_fname != NULL
&& (arg == NULL || vim_strchr((char *)arg, '%') != NULL) && !got_int
&& (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int
&& !message_filtered(curbuf->b_fname)) {
msg_puts("\n c \"% ");
dis_msg(curbuf->b_fname, false);
}
// display alternate file name
if ((arg == NULL || vim_strchr((char *)arg, '%') != NULL) && !got_int) {
if ((arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) {
char *fname;
linenr_T dummy;
@@ -3883,14 +3883,14 @@ void ex_display(exarg_T *eap)
// display last search pattern
if (last_search_pat() != NULL
&& (arg == NULL || vim_strchr((char *)arg, '/') != NULL) && !got_int
&& (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int
&& !message_filtered((char *)last_search_pat())) {
msg_puts("\n c \"/ ");
dis_msg((char *)last_search_pat(), false);
}
// display last used expression
if (expr_line != NULL && (arg == NULL || vim_strchr((char *)arg, '=') != NULL)
if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL)
&& !got_int && !message_filtered(expr_line)) {
msg_puts("\n c \"= ");
dis_msg(expr_line, false);

View File

@@ -1113,7 +1113,7 @@ const char *gettail_dir(const char *const fname)
/// Returns the total number of matches.
///
/// @param flags EW_* flags
static int expand_in_path(garray_T *const gap, char_u *const pattern, const int flags)
static int expand_in_path(garray_T *const gap, char *const pattern, const int flags)
{
garray_T path_ga;
@@ -1127,7 +1127,7 @@ static int expand_in_path(garray_T *const gap, char_u *const pattern, const int
return 0;
}
char_u *const paths = ga_concat_strings(&path_ga);
char *const paths = (char *)ga_concat_strings(&path_ga);
ga_clear_strings(&path_ga);
int glob_flags = 0;
@@ -1137,7 +1137,7 @@ static int expand_in_path(garray_T *const gap, char_u *const pattern, const int
if (flags & EW_ADDSLASH) {
glob_flags |= WILD_ADD_SLASH;
}
globpath((char *)paths, (char *)pattern, gap, glob_flags);
globpath(paths, pattern, gap, glob_flags);
xfree(paths);
return gap->ga_len;
@@ -1208,7 +1208,7 @@ static bool has_special_wildchar(char_u *p)
int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, int flags)
{
garray_T ga;
char_u *p;
char *p;
static bool recursive = false;
int add_pat;
bool did_expand_in_path = false;
@@ -1245,10 +1245,10 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
for (int i = 0; i < num_pat && !got_int; i++) {
add_pat = -1;
p = (char_u *)pat[i];
p = pat[i];
if (vim_backtick((char *)p)) {
add_pat = expand_backtick(&ga, (char *)p, flags);
if (vim_backtick(p)) {
add_pat = expand_backtick(&ga, p, flags);
if (add_pat == -1) {
recursive = false;
ga_clear_strings(&ga);
@@ -1258,16 +1258,16 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
}
} else {
// First expand environment variables, "~/" and "~user/".
if ((has_env_var(p) && !(flags & EW_NOTENV)) || *p == '~') {
p = expand_env_save_opt(p, true);
if ((has_env_var((char_u *)p) && !(flags & EW_NOTENV)) || *p == '~') {
p = (char *)expand_env_save_opt((char_u *)p, true);
if (p == NULL) {
p = (char_u *)pat[i];
p = pat[i];
} else {
#ifdef UNIX
// On Unix, if expand_env() can't expand an environment
// variable, use the shell to do that. Discard previously
// found file names and start all over again.
if (has_env_var(p) || *p == '~') {
if (has_env_var((char_u *)p) || *p == '~') {
xfree(p);
ga_clear_strings(&ga);
i = os_expand_wildcards(num_pat, pat, num_file, file,
@@ -1284,9 +1284,9 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
// there is no match, and EW_NOTFOUND is given, add the pattern.
// Otherwise: Add the file name if it exists or when EW_NOTFOUND is
// given.
if (path_has_exp_wildcard(p) || (flags & EW_ICASE)) {
if (path_has_exp_wildcard((char_u *)p) || (flags & EW_ICASE)) {
if ((flags & EW_PATH)
&& !path_is_absolute(p)
&& !path_is_absolute((char_u *)p)
&& !(p[0] == '.'
&& (vim_ispathsep(p[1])
|| (p[1] == '.'
@@ -1298,7 +1298,7 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
recursive = true;
did_expand_in_path = true;
} else {
size_t tmp_add_pat = path_expand(&ga, p, flags);
size_t tmp_add_pat = path_expand(&ga, (char_u *)p, flags);
assert(tmp_add_pat <= INT_MAX);
add_pat = (int)tmp_add_pat;
}
@@ -1306,14 +1306,14 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
}
if (add_pat == -1 || (add_pat == 0 && (flags & EW_NOTFOUND))) {
char_u *t = (char_u *)backslash_halve_save((char *)p);
char *t = backslash_halve_save(p);
// When EW_NOTFOUND is used, always add files and dirs. Makes
// "vim c:/" work.
if (flags & EW_NOTFOUND) {
addfile(&ga, (char *)t, flags | EW_DIR | EW_FILE);
addfile(&ga, t, flags | EW_DIR | EW_FILE);
} else {
addfile(&ga, (char *)t, flags);
addfile(&ga, t, flags);
}
if (t != p) {
@@ -1322,9 +1322,9 @@ int gen_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, i
}
if (did_expand_in_path && !GA_EMPTY(&ga) && (flags & EW_PATH)) {
uniquefy_paths(&ga, (char *)p);
uniquefy_paths(&ga, p);
}
if (p != (char_u *)pat[i]) {
if (p != pat[i]) {
xfree(p);
}
}

View File

@@ -2254,7 +2254,7 @@ int check_linecomment(const char *line)
}
} else if (!in_str && ((p - line) < 2
|| (*(p - 1) != '\\' && *(p - 2) != '#'))
&& !is_pos_in_string((char_u *)line, (colnr_T)(p - line))) {
&& !is_pos_in_string(line, (colnr_T)(p - line))) {
break; // found!
}
p++;
@@ -2268,7 +2268,7 @@ int check_linecomment(const char *line)
// because * / / * is an end and start of a C comment. Only
// accept the position if it is not inside a string.
if (p[1] == '/' && (p == line || p[-1] != '*' || p[2] != '*')
&& !is_pos_in_string((char_u *)line, (colnr_T)(p - line))) {
&& !is_pos_in_string(line, (colnr_T)(p - line))) {
break;
}
p++;

View File

@@ -740,8 +740,8 @@ static int syn_match_linecont(linenr_T lnum)
if (syn_block->b_syn_linecont_prog != NULL) {
regmmatch_T regmatch;
// chartab array for syn iskeyword
char_u buf_chartab[32];
save_chartab((char *)buf_chartab);
char buf_chartab[32];
save_chartab(buf_chartab);
regmatch.rmm_ic = syn_block->b_syn_linecont_ic;
regmatch.regprog = syn_block->b_syn_linecont_prog;
@@ -749,7 +749,7 @@ static int syn_match_linecont(linenr_T lnum)
IF_SYN_TIME(&syn_block->b_syn_linecont_time));
syn_block->b_syn_linecont_prog = regmatch.regprog;
restore_chartab((char *)buf_chartab);
restore_chartab(buf_chartab);
return r;
}
return false;
@@ -1507,8 +1507,8 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
regmmatch_T regmatch;
lpos_T pos;
reg_extmatch_T *cur_extmatch = NULL;
char_u buf_chartab[32]; // chartab array for syn iskeyword
char_u *line; // current line. NOTE: becomes invalid after
char buf_chartab[32]; // chartab array for syn iskeyword
char *line; // current line. NOTE: becomes invalid after
// looking for a pattern match!
// variables for zero-width matches that have a "nextgroup" argument
@@ -1518,7 +1518,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
// No character, no attributes! Past end of line?
// Do try matching with an empty line (could be the start of a region).
line = (char_u *)syn_getcurline();
line = syn_getcurline();
if (line[current_col] == NUL && current_col != 0) {
// If we found a match after the last column, use it.
if (next_match_idx >= 0 && next_match_col >= (int)current_col
@@ -1555,7 +1555,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
ga_init(&zero_width_next_ga, (int)sizeof(int), 10);
// use syntax iskeyword option
save_chartab((char *)buf_chartab);
save_chartab(buf_chartab);
// Repeat matching keywords and patterns, to find contained items at the
// same column. This stops when there are no extra matches at the current
@@ -1581,14 +1581,14 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
// 2. Check for keywords, if on a keyword char after a non-keyword
// char. Don't do this when syncing.
if (do_keywords) {
line = (char_u *)syn_getcurline();
const char_u *cur_pos = line + current_col;
if (vim_iswordp_buf((char *)cur_pos, syn_buf)
line = syn_getcurline();
const char *cur_pos = line + current_col;
if (vim_iswordp_buf(cur_pos, syn_buf)
&& (current_col == 0
|| !vim_iswordp_buf((char *)cur_pos - 1 -
utf_head_off((char *)line, (char *)cur_pos - 1),
|| !vim_iswordp_buf(cur_pos - 1 -
utf_head_off(line, cur_pos - 1),
syn_buf))) {
syn_id = check_keyword_id((char *)line, (int)current_col, &endcol, &flags,
syn_id = check_keyword_id(line, (int)current_col, &endcol, &flags,
&next_list, cur_si, &cchar);
if (syn_id != 0) {
push_current_state(KEYWORD_IDX);
@@ -1827,7 +1827,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
// - this is an empty line and the "skipempty" option was given
// - we are on white space and the "skipwhite" option was given
if (!found_match) {
line = (char_u *)syn_getcurline();
line = syn_getcurline();
if (((current_next_flags & HL_SKIPWHITE)
&& ascii_iswhite(line[current_col]))
|| ((current_next_flags & HL_SKIPEMPTY)
@@ -1850,7 +1850,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
}
} while (found_match);
restore_chartab((char *)buf_chartab);
restore_chartab(buf_chartab);
// Use attributes from the current state, if within its highlighting.
// If not, use attributes from the current-but-one state, etc.
@@ -1944,7 +1944,7 @@ static int syn_current_attr(const bool syncing, const bool displaying, bool *con
// nextgroup ends at end of line, unless "skipnl" or "skipempty" present
if (current_next_list != NULL
&& (line = (char_u *)syn_getcurline())[current_col] != NUL
&& (line = syn_getcurline())[current_col] != NUL
&& line[current_col + 1] == NUL
&& !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY))) {
current_next_list = NULL;
@@ -2362,7 +2362,7 @@ static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_
lpos_T pos;
char *line;
bool had_match = false;
char_u buf_chartab[32]; // chartab array for syn option iskeyword
char buf_chartab[32]; // chartab array for syn option iskeyword
// just in case we are invoked for a keyword
if (idx < 0) {
@@ -2404,7 +2404,7 @@ static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_
best_regmatch.startpos[0].col = 0; // avoid compiler warning
// use syntax iskeyword option
save_chartab((char *)buf_chartab);
save_chartab(buf_chartab);
for (;;) {
// Find end pattern that matches first after "matchcol".
@@ -2545,7 +2545,7 @@ static void find_endpos(int idx, lpos_T *startpos, lpos_T *m_endpos, lpos_T *hl_
m_endpos->lnum = 0;
}
restore_chartab((char *)buf_chartab);
restore_chartab(buf_chartab);
// Remove external matches.
unref_extmatch(re_extmatch_in);
@@ -2584,8 +2584,8 @@ static void syn_add_end_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp
{
int col;
int off;
char_u *base;
char_u *p;
char *base;
char *p;
if (spp->sp_off_flags & (1 << idx)) {
result->lnum = regmatch->startpos[0].lnum;
@@ -2601,7 +2601,7 @@ static void syn_add_end_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *spp
if (result->lnum > syn_buf->b_ml.ml_line_count) {
col = 0;
} else if (off != 0) {
base = (char_u *)ml_get_buf(syn_buf, result->lnum, false);
base = ml_get_buf(syn_buf, result->lnum, false);
p = base + col;
if (off > 0) {
while (off-- > 0 && *p != NUL) {
@@ -2628,8 +2628,8 @@ static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *s
{
int col;
int off;
char_u *base;
char_u *p;
char *base;
char *p;
if (spp->sp_off_flags & (1 << (idx + SPO_COUNT))) {
result->lnum = regmatch->endpos[0].lnum;
@@ -2646,7 +2646,7 @@ static void syn_add_start_off(lpos_T *result, regmmatch_T *regmatch, synpat_T *s
col = (int)strlen(ml_get_buf(syn_buf, result->lnum, false));
}
if (off != 0) {
base = (char_u *)ml_get_buf(syn_buf, result->lnum, false);
base = ml_get_buf(syn_buf, result->lnum, false);
p = base + col;
if (off > 0) {
while (off-- && *p != NUL) {
@@ -2795,15 +2795,15 @@ static keyentry_T *match_keyword(char *keyword, hashtab_T *ht, stateitem_T *cur_
// Handle ":syntax conceal" command.
static void syn_cmd_conceal(exarg_T *eap, int syncing)
{
char_u *arg = (char_u *)eap->arg;
char_u *next;
char *arg = eap->arg;
char *next;
eap->nextcmd = find_nextcmd((char *)arg);
eap->nextcmd = find_nextcmd(arg);
if (eap->skip) {
return;
}
next = (char_u *)skiptowhite((char *)arg);
next = skiptowhite(arg);
if (*arg == NUL) {
if (curwin->w_s->b_syn_conceal) {
msg("syntax conceal on");
@@ -2849,10 +2849,10 @@ static void syn_cmd_case(exarg_T *eap, int syncing)
/// Handle ":syntax foldlevel" command.
static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
{
char_u *arg = (char_u *)eap->arg;
char_u *arg_end;
char *arg = eap->arg;
char *arg_end;
eap->nextcmd = find_nextcmd((char *)arg);
eap->nextcmd = find_nextcmd(arg);
if (eap->skip) {
return;
}
@@ -2869,7 +2869,7 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
return;
}
arg_end = (char_u *)skiptowhite((char *)arg);
arg_end = skiptowhite(arg);
if (STRNICMP(arg, "start", 5) == 0 && arg_end - arg == 5) {
curwin->w_s->b_syn_foldlevel = SYNFLD_START;
} else if (STRNICMP(arg, "minimum", 7) == 0 && arg_end - arg == 7) {
@@ -2879,7 +2879,7 @@ static void syn_cmd_foldlevel(exarg_T *eap, int syncing)
return;
}
arg = (char_u *)skipwhite((char *)arg_end);
arg = skipwhite(arg_end);
if (*arg != NUL) {
semsg(_(e_illegal_arg), arg);
}
@@ -3216,10 +3216,10 @@ void syn_maybe_enable(void)
/// @param syncing when true: list syncing items
static void syn_cmd_list(exarg_T *eap, int syncing)
{
char_u *arg = (char_u *)eap->arg;
char_u *arg_end;
char *arg = eap->arg;
char *arg_end;
eap->nextcmd = find_nextcmd((char *)arg);
eap->nextcmd = find_nextcmd(arg);
if (eap->skip) {
return;
}
@@ -3272,26 +3272,26 @@ static void syn_cmd_list(exarg_T *eap, int syncing)
} else {
// List the group IDs and syntax clusters that are in the argument.
while (!ends_excmd(*arg) && !got_int) {
arg_end = (char_u *)skiptowhite((char *)arg);
arg_end = skiptowhite(arg);
if (*arg == '@') {
int id = syn_scl_namen2id((char *)arg + 1, (int)(arg_end - arg - 1));
int id = syn_scl_namen2id(arg + 1, (int)(arg_end - arg - 1));
if (id == 0) {
semsg(_("E392: No such syntax cluster: %s"), arg);
} else {
syn_list_cluster(id - SYNID_CLUSTER);
}
} else {
int id = syn_name2id_len((char *)arg, (size_t)(arg_end - arg));
int id = syn_name2id_len(arg, (size_t)(arg_end - arg));
if (id == 0) {
semsg(_(e_nogroup), arg);
} else {
syn_list_one(id, syncing, true);
}
}
arg = (char_u *)skipwhite((char *)arg_end);
arg = skipwhite(arg_end);
}
}
eap->nextcmd = check_nextcmd((char *)arg);
eap->nextcmd = check_nextcmd(arg);
}
static void syn_lines_msg(void)

View File

@@ -64,18 +64,18 @@
typedef struct tag_pointers {
// filled in by parse_tag_line():
char *tagname; // start of tag name (skip "file:")
char_u *tagname_end; // char after tag name
char_u *fname; // first char of file name
char_u *fname_end; // char after file name
char *tagname_end; // char after tag name
char *fname; // first char of file name
char *fname_end; // char after file name
char *command; // first char of command
// filled in by parse_match():
char_u *command_end; // first char after command
char *command_end; // first char after command
char *tag_fname; // file name of the tags file. This is used
// when 'tr' is set.
char_u *tagkind; // "kind:" value
char_u *tagkind_end; // end of tagkind
char *tagkind; // "kind:" value
char *tagkind_end; // end of tagkind
char *user_data; // user_data string
char_u *user_data_end; // end of user_data
char *user_data_end; // end of user_data
linenr_T tagline; // "line:" value
} tagptrs_T;
@@ -188,12 +188,10 @@ typedef struct {
# include "tag.c.generated.h"
#endif
static char_u *bottommsg = (char_u *)N_("E555: at bottom of tag stack");
static char_u *topmsg = (char_u *)N_("E556: at top of tag stack");
static char_u *recurmsg
= (char_u *)N_("E986: cannot modify the tag stack within tagfunc");
static char_u *tfu_inv_ret_msg
= (char_u *)N_("E987: invalid return value from tagfunc");
static char *bottommsg = N_("E555: at bottom of tag stack");
static char *topmsg = N_("E556: at top of tag stack");
static char *recurmsg = N_("E986: cannot modify the tag stack within tagfunc");
static char *tfu_inv_ret_msg = N_("E987: invalid return value from tagfunc");
static char e_window_unexpectedly_close_while_searching_for_tags[]
= N_("E1299: Window unexpectedly closed while searching for tags");
@@ -294,7 +292,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
char **new_matches;
int use_tagstack;
int skip_msg = false;
char_u *buf_ffname = (char_u *)curbuf->b_ffname; // name for priority computation
char *buf_ffname = curbuf->b_ffname; // name for priority computation
int use_tfu = 1;
char *tofree = NULL;
@@ -537,7 +535,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
buf_T *buf = buflist_findnr(cur_fnum);
if (buf != NULL) {
buf_ffname = (char_u *)buf->b_ffname;
buf_ffname = buf->b_ffname;
}
}
@@ -592,7 +590,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
}
if (find_tags(name, &new_num_matches, &new_matches, flags,
max_num_matches, (char *)buf_ffname) == OK
max_num_matches, buf_ffname) == OK
&& new_num_matches < max_num_matches) {
max_num_matches = MAXCOL; // If less than max_num_matches
// found: all matches found.
@@ -622,11 +620,11 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
for (i = idx; i < new_num_matches; i++) {
parse_match(new_matches[i], &tagp2);
if (strcmp(tagp.tagname, tagp2.tagname) == 0) {
char_u *p = (char_u *)new_matches[i];
char *p = new_matches[i];
for (k = i; k > idx; k--) {
new_matches[k] = new_matches[k - 1];
}
new_matches[idx++] = (char *)p;
new_matches[idx++] = p;
break;
}
}
@@ -653,7 +651,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
print_tag_list(new_tag, use_tagstack, num_matches, matches);
ask_for_selection = true;
} else if (type == DT_LTAG) {
if (add_llist_tags((char_u *)tag, num_matches, matches) == FAIL) {
if (add_llist_tags(tag, num_matches, matches) == FAIL) {
goto end_do_tag;
}
@@ -700,7 +698,7 @@ void do_tag(char *tag, int type, int count, int forceit, int verbose)
&& tagp2.user_data) {
XFREE_CLEAR(tagstack[tagstackidx].user_data);
tagstack[tagstackidx].user_data =
xstrnsave(tagp2.user_data, (size_t)(tagp2.user_data_end - (char_u *)tagp2.user_data));
xstrnsave(tagp2.user_data, (size_t)(tagp2.user_data_end - tagp2.user_data));
}
tagstackidx++;
@@ -801,7 +799,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
int tagstackidx = curwin->w_tagstackidx;
int i;
char *p;
char_u *command_end;
char *command_end;
tagptrs_T tagp;
int taglen;
int attr;
@@ -809,7 +807,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
// Assume that the first match indicates how long the tags can
// be, and align the file names to that.
parse_match(matches[0], &tagp);
taglen = (int)(tagp.tagname_end - (char_u *)tagp.tagname + 2);
taglen = (int)(tagp.tagname_end - tagp.tagname + 2);
if (taglen < 18) {
taglen = 18;
}
@@ -841,19 +839,19 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
mt_names[matches[i][0] & MT_MASK]);
msg_puts(IObuff);
if (tagp.tagkind != NULL) {
msg_outtrans_len((char *)tagp.tagkind,
msg_outtrans_len(tagp.tagkind,
(int)(tagp.tagkind_end - tagp.tagkind));
}
msg_advance(13);
msg_outtrans_len_attr(tagp.tagname,
(int)(tagp.tagname_end - (char_u *)tagp.tagname),
(int)(tagp.tagname_end - tagp.tagname),
HL_ATTR(HLF_T));
msg_putchar(' ');
taglen_advance(taglen);
// Find out the actual file name. If it is long, truncate
// it and put "..." in the middle
p = (char *)tag_full_fname(&tagp);
p = tag_full_fname(&tagp);
if (p != NULL) {
msg_outtrans_attr(p, HL_ATTR(HLF_D));
XFREE_CLEAR(p);
@@ -869,7 +867,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
// print any extra fields
command_end = tagp.command_end;
if (command_end != NULL) {
p = (char *)command_end + 3;
p = command_end + 3;
while (*p && *p != '\r' && *p != '\n') {
while (*p == TAB) {
p++;
@@ -881,10 +879,10 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
continue;
}
// skip "kind:<kind>" and "<kind>"
if (p == (char *)tagp.tagkind
|| (p + 5 == (char *)tagp.tagkind
if (p == tagp.tagkind
|| (p + 5 == tagp.tagkind
&& strncmp(p, "kind:", 5) == 0)) {
p = (char *)tagp.tagkind_end;
p = tagp.tagkind_end;
continue;
}
// print all other extra fields
@@ -918,7 +916,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
for (p = tagp.command;
*p && *p != '\r' && *p != '\n';
p++) {}
command_end = (char_u *)p;
command_end = p;
}
// Put the info (in several lines) at column 15.
@@ -931,11 +929,11 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
}
}
// Remove leading whitespace from pattern
while (p != (char *)command_end && ascii_isspace(*p)) {
while (p != command_end && ascii_isspace(*p)) {
p++;
}
while (p != (char *)command_end) {
while (p != command_end) {
if (msg_col + (*p == TAB ? 1 : ptr2cells(p)) > Columns) {
msg_putchar('\n');
}
@@ -959,12 +957,12 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
}
// don't display the "$/;\"" and "$?;\""
if (p == (char *)command_end - 2 && *p == '$'
if (p == command_end - 2 && *p == '$'
&& *(p + 1) == *tagp.command) {
break;
}
// don't display matching '/' or '?'
if (p == (char *)command_end - 1 && *p == *tagp.command
if (p == command_end - 1 && *p == *tagp.command
&& (*p == '/' || *p == '?')) {
break;
}
@@ -981,7 +979,7 @@ static void print_tag_list(int new_tag, int use_tagstack, int num_matches, char
/// Add the matching tags to the location list for the current
/// window.
static int add_llist_tags(char_u *tag, int num_matches, char **matches)
static int add_llist_tags(char *tag, int num_matches, char **matches)
{
list_T *list;
char tag_name[128 + 1];
@@ -1003,7 +1001,7 @@ static int add_llist_tags(char_u *tag, int num_matches, char **matches)
parse_match(matches[i], &tagp);
// Save the tag name
len = (int)(tagp.tagname_end - (char_u *)tagp.tagname);
len = (int)(tagp.tagname_end - tagp.tagname);
if (len > 128) {
len = 128;
}
@@ -1011,7 +1009,7 @@ static int add_llist_tags(char_u *tag, int num_matches, char **matches)
tag_name[len] = NUL;
// Save the tag file name
p = (char *)tag_full_fname(&tagp);
p = tag_full_fname(&tagp);
if (p == NULL) {
continue;
}
@@ -1025,17 +1023,17 @@ static int add_llist_tags(char_u *tag, int num_matches, char **matches)
// Line number is used to locate the tag
lnum = atol(tagp.command);
} else {
char_u *cmd_start, *cmd_end;
char *cmd_start, *cmd_end;
// Search pattern is used to locate the tag
// Locate the end of the command
cmd_start = (char_u *)tagp.command;
cmd_start = tagp.command;
cmd_end = tagp.command_end;
if (cmd_end == NULL) {
for (p = tagp.command;
*p && *p != '\r' && *p != '\n'; p++) {}
cmd_end = (char_u *)p;
cmd_end = p;
}
// Now, cmd_end points to the character after the
@@ -1129,7 +1127,7 @@ static void taglen_advance(int l)
void do_tags(exarg_T *eap)
{
int i;
char_u *name;
char *name;
taggy_T *tagstack = curwin->w_tagstack;
int tagstackidx = curwin->w_tagstackidx;
int tagstacklen = curwin->w_tagstacklen;
@@ -1151,7 +1149,7 @@ void do_tags(exarg_T *eap)
tagstack[i].tagname,
tagstack[i].fmark.mark.lnum);
msg_outtrans(IObuff);
msg_outtrans_attr((char *)name, tagstack[i].fmark.fnum == curbuf->b_fnum
msg_outtrans_attr(name, tagstack[i].fmark.fnum == curbuf->b_fnum
? HL_ATTR(HLF_D) : 0);
xfree(name);
}
@@ -1229,8 +1227,7 @@ static void prepare_pats(pat_T *pats, int has_re)
/// @param match_count here the number of tags found will be placed
/// @param flags flags from find_tags (TAG_*)
/// @param buf_ffname name of buffer for priority
static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int flags,
char_u *buf_ffname)
static int find_tagfunc_tags(char *pat, garray_T *ga, int *match_count, int flags, char *buf_ffname)
{
pos_T save_pos;
list_T *taglist;
@@ -1238,7 +1235,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
int result = FAIL;
typval_T args[4];
typval_T rettv;
char_u flagString[4];
char flagString[4];
taggy_T *tag = NULL;
if (curwin->w_tagstacklen > 0) {
@@ -1254,9 +1251,9 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
}
args[0].v_type = VAR_STRING;
args[0].vval.v_string = (char *)pat;
args[0].vval.v_string = pat;
args[1].v_type = VAR_STRING;
args[1].vval.v_string = (char *)flagString;
args[1].vval.v_string = flagString;
// create 'info' dict argument
dict_T *const d = tv_dict_alloc_lock(VAR_FIXED);
@@ -1273,7 +1270,7 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
args[3].v_type = VAR_UNKNOWN;
vim_snprintf((char *)flagString, sizeof(flagString),
vim_snprintf(flagString, sizeof(flagString),
"%s%s%s",
g_tag_at_cursor ? "c": "",
flags & TAG_INS_COMP ? "i": "",
@@ -1300,9 +1297,9 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
TV_LIST_ITER_CONST(taglist, li, {
char *res_name;
char_u *res_fname;
char_u *res_cmd;
char_u *res_kind;
char *res_fname;
char *res_cmd;
char *res_kind;
int has_extra = 0;
int name_only = flags & TAG_NAMES;
@@ -1331,16 +1328,16 @@ static int find_tagfunc_tags(char_u *pat, garray_T *ga, int *match_count, int fl
continue;
}
if (!strcmp(dict_key, "filename")) {
res_fname = (char_u *)tv->vval.v_string;
res_fname = tv->vval.v_string;
continue;
}
if (!strcmp(dict_key, "cmd")) {
res_cmd = (char_u *)tv->vval.v_string;
res_cmd = tv->vval.v_string;
continue;
}
has_extra = 1;
if (!strcmp(dict_key, "kind")) {
res_kind = (char_u *)tv->vval.v_string;
res_kind = tv->vval.v_string;
continue;
}
// Other elements will be stored as "\tKEY:VALUE"
@@ -1543,8 +1540,8 @@ static int findtags_apply_tfu(findtags_state_T *st, char *pat, char *buf_ffname)
}
tfu_in_use = true;
int retval = find_tagfunc_tags((char_u *)pat, st->ga_match, &st->match_count,
st->flags, (char_u *)buf_ffname);
int retval = find_tagfunc_tags(pat, st->ga_match, &st->match_count,
st->flags, buf_ffname);
tfu_in_use = false;
return retval;
@@ -1748,7 +1745,7 @@ static tagmatch_status_T findtags_parse_line(findtags_state_T *st, tagptrs_T *ta
if (st->orgpat->headlen) {
CLEAR_FIELD(*tagpp);
tagpp->tagname = st->lbuf;
tagpp->tagname_end = (char_u *)vim_strchr(st->lbuf, TAB);
tagpp->tagname_end = vim_strchr(st->lbuf, TAB);
if (tagpp->tagname_end == NULL) {
// Corrupted tag line.
return TAG_MATCH_FAIL;
@@ -1756,7 +1753,7 @@ static tagmatch_status_T findtags_parse_line(findtags_state_T *st, tagptrs_T *ta
// Skip this line if the length of the tag is different and
// there is no regexp, or the tag is too short.
cmplen = (int)(tagpp->tagname_end - (char_u *)tagpp->tagname);
cmplen = (int)(tagpp->tagname_end - tagpp->tagname);
if (p_tl != 0 && cmplen > p_tl) { // adjust for 'taglength'
cmplen = (int)p_tl;
}
@@ -1854,15 +1851,15 @@ static tagmatch_status_T findtags_parse_line(findtags_state_T *st, tagptrs_T *ta
// Can be a matching tag, isolate the file name and command.
tagpp->fname = tagpp->tagname_end + 1;
tagpp->fname_end = (char_u *)vim_strchr((char *)tagpp->fname, TAB);
tagpp->fname_end = vim_strchr(tagpp->fname, TAB);
if (tagpp->fname_end == NULL) {
status = FAIL;
} else {
tagpp->command = (char *)tagpp->fname_end + 1;
tagpp->command = tagpp->fname_end + 1;
status = OK;
}
} else {
status = parse_tag_line((char_u *)st->lbuf, tagpp);
status = parse_tag_line(st->lbuf, tagpp);
}
if (status == FAIL) {
@@ -1893,7 +1890,7 @@ static bool findtags_match_tag(findtags_state_T *st, tagptrs_T *tagpp, findtags_
// First try matching with the pattern literally (also when it is
// a regexp).
int cmplen = (int)(tagpp->tagname_end - (char_u *)tagpp->tagname);
int cmplen = (int)(tagpp->tagname_end - tagpp->tagname);
if (p_tl != 0 && cmplen > p_tl) { // adjust for 'taglength'
cmplen = (int)p_tl;
}
@@ -1915,7 +1912,7 @@ static bool findtags_match_tag(findtags_state_T *st, tagptrs_T *tagpp, findtags_
// Has a regexp: Also find tags matching regexp.
margs->match_re = false;
if (!match && st->orgpat->regmatch.regprog != NULL) {
int cc = *tagpp->tagname_end;
char cc = *tagpp->tagname_end;
*tagpp->tagname_end = NUL;
match = vim_regexec(&st->orgpat->regmatch, tagpp->tagname, (colnr_T)0);
if (match) {
@@ -1927,7 +1924,7 @@ static bool findtags_match_tag(findtags_state_T *st, tagptrs_T *tagpp, findtags_
st->orgpat->regmatch.rm_ic = true;
}
}
*tagpp->tagname_end = (char_u)cc;
*tagpp->tagname_end = cc;
margs->match_re = true;
}
@@ -1968,10 +1965,10 @@ static void findtags_add_match(findtags_state_T *st, tagptrs_T *tagpp, findtags_
bool is_static; // current tag line is static
char *mfp;
char *p;
char_u *s;
char *s;
// Decide in which array to store this match.
is_current = test_for_current((char *)tagpp->fname, (char *)tagpp->fname_end,
is_current = test_for_current(tagpp->fname, tagpp->fname_end,
st->tag_fname, buf_ffname);
is_static = test_for_static(tagpp);
@@ -2006,7 +2003,7 @@ static void findtags_add_match(findtags_state_T *st, tagptrs_T *tagpp, findtags_
// detecting duplicates.
// The format is {tagname}@{lang}NUL{heuristic}NUL
*tagpp->tagname_end = NUL;
len = (size_t)(tagpp->tagname_end - (char_u *)tagpp->tagname);
len = (size_t)(tagpp->tagname_end - tagpp->tagname);
mfp = xmalloc(sizeof(char) + len + 10 + ML_EXTRA + 1);
p = mfp;
@@ -2040,7 +2037,7 @@ static void findtags_add_match(findtags_state_T *st, tagptrs_T *tagpp, findtags_
}
st->get_searchpat = false;
} else {
len = (size_t)((char *)tagpp->tagname_end - tagpp->tagname);
len = (size_t)(tagpp->tagname_end - tagpp->tagname);
mfp = xmalloc(sizeof(char) + len + 1);
xstrlcpy(mfp, tagpp->tagname, len + 1);
@@ -2069,7 +2066,7 @@ static void findtags_add_match(findtags_state_T *st, tagptrs_T *tagpp, findtags_
slash_adjust(p + 1);
#endif
p[tag_fname_len + 1] = TAG_SEP;
s = (char_u *)p + 1 + tag_fname_len + 1;
s = p + 1 + tag_fname_len + 1;
STRCPY(s, st->lbuf);
}
@@ -2583,7 +2580,7 @@ int get_tagfname(tagname_T *tnp, int first, char *buf)
tnp->tn_did_filefind_init = false;
} else {
char_u *filename = NULL;
char *filename = NULL;
// Stop when used all parts of 'tags'.
if (*tnp->tn_np == NUL) {
@@ -2599,11 +2596,11 @@ int get_tagfname(tagname_T *tnp, int first, char *buf)
r_ptr = (char *)vim_findfile_stopdir((char_u *)buf);
// move the filename one char forward and truncate the
// filepath with a NUL
filename = (char_u *)path_tail(buf);
STRMOVE(filename + 1, (char *)filename);
filename = path_tail(buf);
STRMOVE(filename + 1, filename);
*filename++ = NUL;
tnp->tn_search_ctx = vim_findfile_init(buf, (char *)filename,
tnp->tn_search_ctx = vim_findfile_init(buf, filename,
r_ptr, 100,
false, // don't free visited list
FINDFILE_FILE, // we search for a file
@@ -2636,13 +2633,13 @@ void tagname_free(tagname_T *tnp)
/// @param lbuf line to be parsed
///
/// @return FAIL if there is a format error in this line, OK otherwise.
static int parse_tag_line(char_u *lbuf, tagptrs_T *tagp)
static int parse_tag_line(char *lbuf, tagptrs_T *tagp)
{
char_u *p;
char *p;
// Isolate the tagname, from lbuf up to the first white
tagp->tagname = (char *)lbuf;
p = (char_u *)vim_strchr((char *)lbuf, TAB);
tagp->tagname = lbuf;
p = vim_strchr(lbuf, TAB);
if (p == NULL) {
return FAIL;
}
@@ -2653,7 +2650,7 @@ static int parse_tag_line(char_u *lbuf, tagptrs_T *tagp)
p++;
}
tagp->fname = p;
p = (char_u *)vim_strchr((char *)p, TAB);
p = vim_strchr(p, TAB);
if (p == NULL) {
return FAIL;
}
@@ -2666,7 +2663,7 @@ static int parse_tag_line(char_u *lbuf, tagptrs_T *tagp)
if (*p == NUL) {
return FAIL;
}
tagp->command = (char *)p;
tagp->command = p;
return OK;
}
@@ -2730,7 +2727,7 @@ static int parse_match(char *lbuf, tagptrs_T *tagp)
lbuf += strlen(tagp->tag_fname) + 2;
// Find search pattern and the file name for non-etags.
retval = parse_tag_line((char_u *)lbuf, tagp);
retval = parse_tag_line(lbuf, tagp);
tagp->tagkind = NULL;
tagp->user_data = NULL;
@@ -2741,9 +2738,9 @@ static int parse_match(char *lbuf, tagptrs_T *tagp)
// Try to find a kind field: "kind:<kind>" or just "<kind>"
p = tagp->command;
if (find_extra(&p) == OK) {
tagp->command_end = (char_u *)p;
tagp->command_end = p;
if (p > tagp->command && p[-1] == '|') {
tagp->command_end = (char_u *)p - 1; // drop trailing bar
tagp->command_end = p - 1; // drop trailing bar
}
p += 2; // skip ";\""
if (*p++ == TAB) {
@@ -2751,7 +2748,7 @@ static int parse_match(char *lbuf, tagptrs_T *tagp)
// character.
while (ASCII_ISALPHA(*p) || utfc_ptr2len(p) > 1) {
if (strncmp(p, "kind:", 5) == 0) {
tagp->tagkind = (char_u *)p + 5;
tagp->tagkind = p + 5;
} else if (strncmp(p, "user_data:", 10) == 0) {
tagp->user_data = p + 10;
} else if (strncmp(p, "line:", 5) == 0) {
@@ -2764,7 +2761,7 @@ static int parse_match(char *lbuf, tagptrs_T *tagp)
pc = vim_strchr(p, ':');
pt = vim_strchr(p, '\t');
if (pc == NULL || (pt != NULL && pc > pt)) {
tagp->tagkind = (char_u *)p;
tagp->tagkind = p;
}
if (pt == NULL) {
break;
@@ -2775,16 +2772,16 @@ static int parse_match(char *lbuf, tagptrs_T *tagp)
}
}
if (tagp->tagkind != NULL) {
for (p = (char *)tagp->tagkind;
for (p = tagp->tagkind;
*p && *p != '\t' && *p != '\r' && *p != '\n';
MB_PTR_ADV(p)) {}
tagp->tagkind_end = (char_u *)p;
tagp->tagkind_end = p;
}
if (tagp->user_data != NULL) {
for (p = tagp->user_data;
*p && *p != '\t' && *p != '\r' && *p != '\n';
MB_PTR_ADV(p)) {}
tagp->user_data_end = (char_u *)p;
tagp->user_data_end = p;
}
}
return retval;
@@ -2793,13 +2790,12 @@ static int parse_match(char *lbuf, tagptrs_T *tagp)
// Find out the actual file name of a tag. Concatenate the tags file name
// with the matching tag file name.
// Returns an allocated string.
static char_u *tag_full_fname(tagptrs_T *tagp)
static char *tag_full_fname(tagptrs_T *tagp)
{
int c = *tagp->fname_end;
char c = *tagp->fname_end;
*tagp->fname_end = NUL;
char_u *fullname =
(char_u *)expand_tag_fname((char *)tagp->fname, tagp->tag_fname, false);
*tagp->fname_end = (char_u)c;
char *fullname = expand_tag_fname(tagp->fname, tagp->tag_fname, false);
*tagp->fname_end = c;
return fullname;
}
@@ -2843,7 +2839,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
// truncate the file name, so it can be used as a string
*tagp.fname_end = NUL;
fname = (char *)tagp.fname;
fname = tagp.fname;
// copy the command to pbuf[], remove trailing CR/NL
str = tagp.command;
@@ -2999,7 +2995,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
retval = OK;
} else {
int found = 1;
int cc;
char cc;
// try again, ignore case now
p_ic = true;
@@ -3019,7 +3015,7 @@ static int jumpto_tag(const char_u *lbuf_arg, int forceit, int keep_help)
found = 0;
}
}
*tagp.tagname_end = (char_u)cc;
*tagp.tagname_end = cc;
}
if (found == 0) {
emsg(_("E434: Can't find tag pattern"));
@@ -3159,18 +3155,18 @@ static char *expand_tag_fname(char *fname, char *const tag_fname, const bool exp
/// file.
static int test_for_current(char *fname, char *fname_end, char *tag_fname, char *buf_ffname)
{
int c;
char c;
int retval = false;
if (buf_ffname != NULL) { // if the buffer has a name
{
c = (unsigned char)(*fname_end);
c = *fname_end;
*fname_end = NUL;
}
char *fullname = expand_tag_fname(fname, tag_fname, true);
retval = (path_full_compare(fullname, buf_ffname, true, true) & kEqualFiles);
xfree(fullname);
*fname_end = (char)c;
*fname_end = c;
}
return retval;
@@ -3231,7 +3227,7 @@ int expand_tags(int tagnames, char *pat, int *num_file, char ***file)
{
int i;
int extra_flag;
char_u *name_buf;
char *name_buf;
size_t name_buf_size = 100;
tagptrs_T t_p;
int ret;
@@ -3259,9 +3255,9 @@ int expand_tags(int tagnames, char *pat, int *num_file, char ***file)
size_t len;
parse_match((*file)[i], &t_p);
len = (size_t)(t_p.tagname_end - (char_u *)t_p.tagname);
len = (size_t)(t_p.tagname_end - t_p.tagname);
if (len > name_buf_size - 3) {
char_u *buf;
char *buf;
name_buf_size = len + 3;
buf = xrealloc(name_buf, name_buf_size);
@@ -3354,12 +3350,12 @@ int get_tags(list_T *list, char *pat, char *buf_fname)
dict = tv_dict_alloc();
tv_list_append_dict(list, dict);
full_fname = (char *)tag_full_fname(&tp);
if (add_tag_field(dict, "name", tp.tagname, (char *)tp.tagname_end) == FAIL
full_fname = tag_full_fname(&tp);
if (add_tag_field(dict, "name", tp.tagname, tp.tagname_end) == FAIL
|| add_tag_field(dict, "filename", full_fname, NULL) == FAIL
|| add_tag_field(dict, "cmd", tp.command, (char *)tp.command_end) == FAIL
|| add_tag_field(dict, "kind", (char *)tp.tagkind,
tp.tagkind ? (char *)tp.tagkind_end : NULL) == FAIL
|| add_tag_field(dict, "cmd", tp.command, tp.command_end) == FAIL
|| add_tag_field(dict, "kind", tp.tagkind,
tp.tagkind ? tp.tagkind_end : NULL) == FAIL
|| tv_dict_add_nr(dict, S_LEN("static"), is_static) == FAIL) {
ret = FAIL;
}
@@ -3367,13 +3363,13 @@ int get_tags(list_T *list, char *pat, char *buf_fname)
xfree(full_fname);
if (tp.command_end != NULL) {
for (char *p = (char *)tp.command_end + 3;
for (char *p = tp.command_end + 3;
*p != NUL && *p != '\n' && *p != '\r';
MB_PTR_ADV(p)) {
if (p == (char *)tp.tagkind
|| (p + 5 == (char *)tp.tagkind && strncmp(p, "kind:", 5) == 0)) {
if (p == tp.tagkind
|| (p + 5 == tp.tagkind && strncmp(p, "kind:", 5) == 0)) {
// skip "kind:<kind>" and "<kind>"
p = (char *)tp.tagkind_end - 1;
p = tp.tagkind_end - 1;
} else if (strncmp(p, "file:", 5) == 0) {
// skip "file:" (static tag)
p += 4;

View File

@@ -653,7 +653,7 @@ int parse_compl_arg(const char *value, int vallen, int *complp, uint32_t *argt,
}
static int uc_scan_attr(char *attr, size_t len, uint32_t *argt, long *def, int *flags, int *complp,
char_u **compl_arg, cmd_addr_T *addr_type_arg)
char **compl_arg, cmd_addr_T *addr_type_arg)
FUNC_ATTR_NONNULL_ALL
{
char *p;
@@ -764,7 +764,7 @@ invalid_count:
return FAIL;
}
if (parse_compl_arg(val, (int)vallen, complp, argt, (char **)compl_arg)
if (parse_compl_arg(val, (int)vallen, complp, argt, compl_arg)
== FAIL) {
return FAIL;
}
@@ -941,7 +941,7 @@ void ex_command(exarg_T *eap)
while (*p == '-') {
p++;
end = skiptowhite(p);
if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &compl, (char_u **)&compl_arg,
if (uc_scan_attr(p, (size_t)(end - p), &argt, &def, &flags, &compl, &compl_arg,
&addr_type_arg) == FAIL) {
goto theend;
}