mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
refactor(memory): use builtin strcat() instead of STRCAT()
The latter was mostly relevant with the past char_u madness. NOTE: STRCAT also functioned as a counterfeit "NOLINT" for clint apparently. But NOLINT-ing every usecase is just the same as disabling the check entirely.
This commit is contained in:
parent
d8e384b7bf
commit
bbd2f340a2
@ -1995,7 +1995,7 @@ def CheckLanguage(filename, clean_lines, linenum, error):
|
||||
if match:
|
||||
error(filename, linenum, 'runtime/printf', 4,
|
||||
'Use xstrlcpy, xmemcpyz or snprintf instead of %s' % match.group(1))
|
||||
match = Search(r'\b(STRNCAT|strncat|strcat|vim_strcat)\b', line)
|
||||
match = Search(r'\b(STRNCAT|strncat|vim_strcat)\b', line)
|
||||
if match:
|
||||
error(filename, linenum, 'runtime/printf', 4,
|
||||
'Use xstrlcat or snprintf instead of %s' % match.group(1))
|
||||
|
@ -711,7 +711,7 @@ char *au_event_disable(char *what)
|
||||
if (*what == ',' && *p_ei == NUL) {
|
||||
STRCPY(new_ei, what + 1);
|
||||
} else {
|
||||
STRCAT(new_ei, what);
|
||||
strcat(new_ei, what);
|
||||
}
|
||||
set_option_direct(kOptEventignore, CSTR_AS_OPTVAL(new_ei), 0, SID_NONE);
|
||||
xfree(new_ei);
|
||||
|
@ -1723,12 +1723,12 @@ bool open_line(int dir, int flags, int second_line_indent, bool *did_do_comment)
|
||||
// Below, set_indent(newindent, SIN_INSERT) will insert the
|
||||
// whitespace needed before the comment char.
|
||||
for (int i = 0; i < padding; i++) {
|
||||
STRCAT(leader, " ");
|
||||
strcat(leader, " ");
|
||||
less_cols--;
|
||||
newcol++;
|
||||
}
|
||||
}
|
||||
STRCAT(leader, p_extra);
|
||||
strcat(leader, p_extra);
|
||||
p_extra = leader;
|
||||
did_ai = true; // So truncating blanks works with comments
|
||||
less_cols -= lead_len;
|
||||
|
@ -3257,7 +3257,7 @@ void globpath(char *path, char *file, garray_T *ga, int expand_options, bool dir
|
||||
copy_option_part(&path, buf, MAXPATHL, ",");
|
||||
if (strlen(buf) + strlen(file) + 2 < MAXPATHL) {
|
||||
add_pathsep(buf);
|
||||
STRCAT(buf, file);
|
||||
strcat(buf, file);
|
||||
|
||||
char **p;
|
||||
int num_p = 0;
|
||||
|
@ -1273,10 +1273,10 @@ void ex_diffpatch(exarg_T *eap)
|
||||
|
||||
// Delete any .orig or .rej file created.
|
||||
STRCPY(buf, tmp_new);
|
||||
STRCAT(buf, ".orig");
|
||||
strcat(buf, ".orig");
|
||||
os_remove(buf);
|
||||
STRCPY(buf, tmp_new);
|
||||
STRCAT(buf, ".rej");
|
||||
strcat(buf, ".rej");
|
||||
os_remove(buf);
|
||||
|
||||
// Only continue if the output file was created.
|
||||
@ -1288,7 +1288,7 @@ void ex_diffpatch(exarg_T *eap)
|
||||
} else {
|
||||
if (curbuf->b_fname != NULL) {
|
||||
newname = xstrnsave(curbuf->b_fname, strlen(curbuf->b_fname) + 4);
|
||||
STRCAT(newname, ".new");
|
||||
strcat(newname, ".new");
|
||||
}
|
||||
|
||||
// don't use a new tab page, each tab page has its own diffs
|
||||
|
@ -7154,8 +7154,8 @@ static char *make_expanded_name(const char *in_start, char *expr_start, char *ex
|
||||
retval = xmalloc(strlen(temp_result) + (size_t)(expr_start - in_start)
|
||||
+ (size_t)(in_end - expr_end) + 1);
|
||||
STRCPY(retval, in_start);
|
||||
STRCAT(retval, temp_result);
|
||||
STRCAT(retval, expr_end + 1);
|
||||
strcat(retval, temp_result);
|
||||
strcat(retval, expr_end + 1);
|
||||
}
|
||||
xfree(temp_result);
|
||||
|
||||
|
@ -265,7 +265,7 @@ static void set_ufunc_name(ufunc_T *fp, char *name)
|
||||
if ((uint8_t)name[0] == K_SPECIAL) {
|
||||
fp->uf_name_exp = xmalloc(strlen(name) + 3);
|
||||
STRCPY(fp->uf_name_exp, "<SNR>");
|
||||
STRCAT(fp->uf_name_exp, fp->uf_name + 3);
|
||||
strcat(fp->uf_name_exp, fp->uf_name + 3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2062,7 +2062,7 @@ char *get_scriptlocal_funcname(char *funcname)
|
||||
const int off = *funcname == 's' ? 2 : 5;
|
||||
char *newname = xmalloc(strlen(sid_buf) + strlen(funcname + off) + 1);
|
||||
STRCPY(newname, sid_buf);
|
||||
STRCAT(newname, funcname + off);
|
||||
strcat(newname, funcname + off);
|
||||
|
||||
return newname;
|
||||
}
|
||||
|
@ -970,13 +970,13 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
|
||||
char *t = xmalloc(len);
|
||||
*t = NUL;
|
||||
if (newcmd != NULL) {
|
||||
STRCAT(t, newcmd);
|
||||
strcat(t, newcmd);
|
||||
}
|
||||
if (ins_prevcmd) {
|
||||
STRCAT(t, prevcmd);
|
||||
strcat(t, prevcmd);
|
||||
}
|
||||
char *p = t + strlen(t);
|
||||
STRCAT(t, trailarg);
|
||||
strcat(t, trailarg);
|
||||
xfree(newcmd);
|
||||
newcmd = t;
|
||||
|
||||
@ -1029,8 +1029,8 @@ void do_bang(int addr_count, exarg_T *eap, bool forceit, bool do_in, bool do_out
|
||||
}
|
||||
newcmd = xmalloc(strlen(prevcmd) + 2 * strlen(p_shq) + 1);
|
||||
STRCPY(newcmd, p_shq);
|
||||
STRCAT(newcmd, prevcmd);
|
||||
STRCAT(newcmd, p_shq);
|
||||
strcat(newcmd, prevcmd);
|
||||
strcat(newcmd, p_shq);
|
||||
free_newcmd = true;
|
||||
}
|
||||
if (addr_count == 0) { // :!
|
||||
@ -4108,7 +4108,7 @@ skip:
|
||||
// the line as reference, because the substitute may
|
||||
// have changed the number of characters. Same for
|
||||
// "prev_matchcol".
|
||||
STRCAT(new_start, sub_firstline + copycol);
|
||||
strcat(new_start, sub_firstline + copycol);
|
||||
matchcol = (colnr_T)strlen(sub_firstline) - matchcol;
|
||||
prev_matchcol = (colnr_T)strlen(sub_firstline)
|
||||
- prev_matchcol;
|
||||
|
@ -3826,8 +3826,8 @@ char *replace_makeprg(exarg_T *eap, char *arg, char **cmdlinep)
|
||||
// No $* in arg, build "<makeprg> <arg>" instead
|
||||
new_cmdline = xmalloc(strlen(program) + strlen(arg) + 2);
|
||||
STRCPY(new_cmdline, program);
|
||||
STRCAT(new_cmdline, " ");
|
||||
STRCAT(new_cmdline, arg);
|
||||
strcat(new_cmdline, " ");
|
||||
strcat(new_cmdline, arg);
|
||||
}
|
||||
|
||||
msg_make(arg);
|
||||
@ -7236,7 +7236,7 @@ char *expand_sfile(char *arg)
|
||||
memmove(newres, result, (size_t)(p - result));
|
||||
STRCPY(newres + (p - result), repl);
|
||||
len = strlen(newres);
|
||||
STRCAT(newres, p + srclen);
|
||||
strcat(newres, p + srclen);
|
||||
xfree(repl);
|
||||
xfree(result);
|
||||
result = newres;
|
||||
|
@ -406,7 +406,7 @@ char *get_exception_string(void *value, except_type_T type, char *cmdname, bool
|
||||
|| (ascii_isdigit(p[3])
|
||||
&& p[4] == ':')))))) {
|
||||
if (*p == NUL || p == mesg) {
|
||||
STRCAT(val, mesg); // 'E123' missing or at beginning
|
||||
strcat(val, mesg); // 'E123' missing or at beginning
|
||||
} else {
|
||||
// '"filename" E123: message text'
|
||||
if (mesg[0] != '"' || p - 2 < &mesg[1]
|
||||
@ -415,7 +415,7 @@ char *get_exception_string(void *value, except_type_T type, char *cmdname, bool
|
||||
continue;
|
||||
}
|
||||
|
||||
STRCAT(val, p);
|
||||
strcat(val, p);
|
||||
p[-2] = NUL;
|
||||
snprintf(val + strlen(p), strlen(" (%s)"), " (%s)", &mesg[1]);
|
||||
p[-2] = '"';
|
||||
|
@ -451,7 +451,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
|
||||
STRCPY(buf, ff_expand_buffer);
|
||||
STRCPY(buf + eb_len, search_ctx->ffsc_fix_path);
|
||||
if (os_isdir(buf)) {
|
||||
STRCAT(ff_expand_buffer, search_ctx->ffsc_fix_path);
|
||||
strcat(ff_expand_buffer, search_ctx->ffsc_fix_path);
|
||||
add_pathsep(ff_expand_buffer);
|
||||
} else {
|
||||
char *p = path_tail(search_ctx->ffsc_fix_path);
|
||||
@ -479,7 +479,7 @@ void *vim_findfile_init(char *path, char *filename, char *stopdirs, int level, i
|
||||
+ strlen(search_ctx->ffsc_fix_path + len)
|
||||
+ 1);
|
||||
STRCPY(temp, search_ctx->ffsc_fix_path + len);
|
||||
STRCAT(temp, search_ctx->ffsc_wc_path);
|
||||
strcat(temp, search_ctx->ffsc_wc_path);
|
||||
xfree(search_ctx->ffsc_wc_path);
|
||||
xfree(wc_path);
|
||||
search_ctx->ffsc_wc_path = temp;
|
||||
@ -681,7 +681,7 @@ char *vim_findfile(void *search_ctx_arg)
|
||||
ff_free_stack_element(stackp);
|
||||
goto fail;
|
||||
}
|
||||
STRCAT(file_path, stackp->ffs_fix_path);
|
||||
strcat(file_path, stackp->ffs_fix_path);
|
||||
if (!add_pathsep(file_path)) {
|
||||
ff_free_stack_element(stackp);
|
||||
goto fail;
|
||||
@ -781,7 +781,7 @@ char *vim_findfile(void *search_ctx_arg)
|
||||
ff_free_stack_element(stackp);
|
||||
goto fail;
|
||||
}
|
||||
STRCAT(file_path, search_ctx->ffsc_file_to_search);
|
||||
strcat(file_path, search_ctx->ffsc_file_to_search);
|
||||
|
||||
// Try without extra suffix and then with suffixes
|
||||
// from 'suffixesadd'.
|
||||
@ -922,7 +922,7 @@ char *vim_findfile(void *search_ctx_arg)
|
||||
if (!add_pathsep(file_path)) {
|
||||
goto fail;
|
||||
}
|
||||
STRCAT(file_path, search_ctx->ffsc_fix_path);
|
||||
strcat(file_path, search_ctx->ffsc_fix_path);
|
||||
|
||||
// create a new stack entry
|
||||
sptr = ff_create_stack_element(file_path,
|
||||
|
@ -3315,7 +3315,7 @@ void f_foldtext(typval_T *argvars, typval_T *rettv, EvalFuncData fptr)
|
||||
char *r = xmalloc(len);
|
||||
snprintf(r, len, txt, dashes, count);
|
||||
len = strlen(r);
|
||||
STRCAT(r, s);
|
||||
strcat(r, s);
|
||||
// remove 'foldmarker' and 'commentstring'
|
||||
foldtext_cleanup(r + len);
|
||||
rettv->vval.v_string = r;
|
||||
|
@ -4059,7 +4059,7 @@ static int get_normal_compl_info(char *line, int startcol, colnr_T curs_col)
|
||||
compl_pattern = xmalloc(7);
|
||||
STRCPY(compl_pattern, "\\<");
|
||||
quote_meta(compl_pattern + 2, line + compl_col, 1);
|
||||
STRCAT(compl_pattern, "\\k");
|
||||
strcat(compl_pattern, "\\k");
|
||||
} else {
|
||||
compl_pattern = xmalloc(quote_meta(NULL, line + compl_col, compl_length) + 2);
|
||||
STRCPY(compl_pattern, "\\<");
|
||||
|
@ -72,5 +72,3 @@ EXTERN size_t arena_alloc_count INIT( = 0);
|
||||
|
||||
// Like strcpy() but allows overlapped source and destination.
|
||||
#define STRMOVE(d, s) memmove((d), (s), strlen(s) + 1)
|
||||
|
||||
#define STRCAT(d, s) strcat((char *)(d), (char *)(s)) // NOLINT(runtime/printf)
|
||||
|
@ -1057,7 +1057,7 @@ char *get_menu_names(expand_T *xp, int idx)
|
||||
}
|
||||
// hack on menu separators: use a 'magic' char for the separator
|
||||
// so that '.' in names gets escaped properly
|
||||
STRCAT(tbuffer, "\001");
|
||||
strcat(tbuffer, "\001");
|
||||
str = tbuffer;
|
||||
} else {
|
||||
if (should_advance) {
|
||||
|
@ -1987,7 +1987,7 @@ bool add_to_showcmd(int c)
|
||||
size_t overflow = old_len + extra_len - limit;
|
||||
memmove(showcmd_buf, showcmd_buf + overflow, old_len - overflow + 1);
|
||||
}
|
||||
STRCAT(showcmd_buf, p);
|
||||
strcat(showcmd_buf, p);
|
||||
|
||||
if (char_avail()) {
|
||||
return false;
|
||||
|
@ -2666,7 +2666,7 @@ static void op_yank_reg(oparg_T *oap, bool message, yankreg_T *reg, bool append)
|
||||
char *pnew = xmalloc(strlen(curr->y_array[curr->y_size - 1])
|
||||
+ strlen(reg->y_array[0]) + 1);
|
||||
STRCPY(pnew, curr->y_array[--j]);
|
||||
STRCAT(pnew, reg->y_array[0]);
|
||||
strcat(pnew, reg->y_array[0]);
|
||||
xfree(curr->y_array[j]);
|
||||
xfree(reg->y_array[0]);
|
||||
curr->y_array[j++] = pnew;
|
||||
@ -3431,7 +3431,7 @@ void do_put(int regname, yankreg_T *reg, int dir, int count, int flags)
|
||||
totlen = strlen(y_array[y_size - 1]);
|
||||
char *newp = xmalloc((size_t)ml_get_len(lnum) - (size_t)col + totlen + 1);
|
||||
STRCPY(newp, y_array[y_size - 1]);
|
||||
STRCAT(newp, ptr);
|
||||
strcat(newp, ptr);
|
||||
// insert second line
|
||||
ml_append(lnum, newp, 0, false);
|
||||
new_lnum++;
|
||||
@ -4747,7 +4747,7 @@ bool do_addsub(int op_type, pos_T *pos, int length, linenr_T Prenum1)
|
||||
}
|
||||
}
|
||||
*ptr = NUL;
|
||||
STRCAT(buf1, buf2);
|
||||
strcat(buf1, buf2);
|
||||
ins_str(buf1); // insert the new number
|
||||
endpos = curwin->w_cursor;
|
||||
if (curwin->w_cursor.col) {
|
||||
|
@ -236,11 +236,11 @@ static void set_init_default_backupskip(void)
|
||||
== NULL) {
|
||||
ga_grow(&ga, (int)len);
|
||||
if (!GA_EMPTY(&ga)) {
|
||||
STRCAT(ga.ga_data, ",");
|
||||
strcat(ga.ga_data, ",");
|
||||
}
|
||||
STRCAT(ga.ga_data, p);
|
||||
strcat(ga.ga_data, p);
|
||||
add_pathsep(ga.ga_data);
|
||||
STRCAT(ga.ga_data, "*");
|
||||
strcat(ga.ga_data, "*");
|
||||
ga.ga_len += (int)len;
|
||||
}
|
||||
xfree(item);
|
||||
|
@ -248,11 +248,11 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
|
||||
} else {
|
||||
STRCPY(command, "(");
|
||||
}
|
||||
STRCAT(command, pat[0] + 1); // exclude first backtick
|
||||
strcat(command, pat[0] + 1); // exclude first backtick
|
||||
p = command + strlen(command) - 1;
|
||||
if (is_fish_shell) {
|
||||
*p-- = ';';
|
||||
STRCAT(command, " end");
|
||||
strcat(command, " end");
|
||||
} else {
|
||||
*p-- = ')'; // remove last backtick
|
||||
}
|
||||
@ -263,7 +263,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
|
||||
ampersand = true;
|
||||
*p = ' ';
|
||||
}
|
||||
STRCAT(command, ">");
|
||||
strcat(command, ">");
|
||||
} else {
|
||||
STRCPY(command, "");
|
||||
if (shell_style == STYLE_GLOB) {
|
||||
@ -271,26 +271,26 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
|
||||
// otherwise, this may set the positional parameters for the shell,
|
||||
// e.g. "$*".
|
||||
if (flags & EW_NOTFOUND) {
|
||||
STRCAT(command, "set nonomatch; ");
|
||||
strcat(command, "set nonomatch; ");
|
||||
} else {
|
||||
STRCAT(command, "unset nonomatch; ");
|
||||
strcat(command, "unset nonomatch; ");
|
||||
}
|
||||
}
|
||||
if (shell_style == STYLE_GLOB) {
|
||||
STRCAT(command, "glob >");
|
||||
strcat(command, "glob >");
|
||||
} else if (shell_style == STYLE_PRINT) {
|
||||
STRCAT(command, "print -N >");
|
||||
strcat(command, "print -N >");
|
||||
} else if (shell_style == STYLE_VIMGLOB) {
|
||||
STRCAT(command, sh_vimglob_func);
|
||||
strcat(command, sh_vimglob_func);
|
||||
} else if (shell_style == STYLE_GLOBSTAR) {
|
||||
STRCAT(command, sh_globstar_opt);
|
||||
STRCAT(command, sh_vimglob_func);
|
||||
strcat(command, sh_globstar_opt);
|
||||
strcat(command, sh_vimglob_func);
|
||||
} else {
|
||||
STRCAT(command, "echo >");
|
||||
strcat(command, "echo >");
|
||||
}
|
||||
}
|
||||
|
||||
STRCAT(command, tempname);
|
||||
strcat(command, tempname);
|
||||
|
||||
if (shell_style != STYLE_BT) {
|
||||
for (i = 0; i < num_pat; i++) {
|
||||
@ -334,7 +334,7 @@ int os_expand_wildcards(int num_pat, char **pat, int *num_file, char ***file, in
|
||||
}
|
||||
|
||||
if (ampersand) {
|
||||
STRCAT(command, "&"); // put the '&' after the redirection
|
||||
strcat(command, "&"); // put the '&' after the redirection
|
||||
}
|
||||
|
||||
// Using zsh -G: If a pattern has no matches, it is just deleted from
|
||||
|
@ -962,7 +962,7 @@ static void uniquefy_paths(garray_T *gap, char *pattern)
|
||||
char *file_pattern = xmalloc(len + 2);
|
||||
file_pattern[0] = '*';
|
||||
file_pattern[1] = NUL;
|
||||
STRCAT(file_pattern, pattern);
|
||||
strcat(file_pattern, pattern);
|
||||
char *pat = file_pat_to_reg_pat(file_pattern, NULL, NULL, true);
|
||||
xfree(file_pattern);
|
||||
if (pat == NULL) {
|
||||
@ -1065,7 +1065,7 @@ static void uniquefy_paths(garray_T *gap, char *pattern)
|
||||
rel_path = xmalloc(strlen(short_name) + strlen(PATHSEPSTR) + 2);
|
||||
STRCPY(rel_path, ".");
|
||||
add_pathsep(rel_path);
|
||||
STRCAT(rel_path, short_name);
|
||||
strcat(rel_path, short_name);
|
||||
|
||||
xfree(fnames[i]);
|
||||
fnames[i] = rel_path;
|
||||
|
@ -4531,7 +4531,7 @@ static char *get_mef_name(void)
|
||||
name = xmalloc(strlen(p_mef) + 30);
|
||||
STRCPY(name, p_mef);
|
||||
snprintf(name + (p - p_mef), strlen(name), "%d%d", start, off);
|
||||
STRCAT(name, p + 2);
|
||||
strcat(name, p + 2);
|
||||
// Don't accept a symbolic link, it's a security risk.
|
||||
FileInfo file_info;
|
||||
bool file_or_link_found = os_fileinfo_link(name, &file_info);
|
||||
@ -7237,7 +7237,7 @@ static void hgr_search_files_in_dir(qf_list_T *qfl, char *dirname, regmatch_T *p
|
||||
|
||||
// Find all "*.txt" and "*.??x" files in the "doc" directory.
|
||||
add_pathsep(dirname);
|
||||
STRCAT(dirname, "doc/*.\\(txt\\|??x\\)"); // NOLINT
|
||||
strcat(dirname, "doc/*.\\(txt\\|??x\\)"); // NOLINT
|
||||
if (gen_expand_wildcards(1, &dirname, &fcount, &fnames, EW_FILE|EW_SILENT) == OK
|
||||
&& fcount > 0) {
|
||||
for (int fi = 0; fi < fcount && !got_int; fi++) {
|
||||
|
@ -11451,7 +11451,7 @@ static void nfa_set_code(int c)
|
||||
}
|
||||
|
||||
if (addnl == true) {
|
||||
STRCAT(code, " + NEWLINE ");
|
||||
strcat(code, " + NEWLINE ");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,7 +409,7 @@ int do_in_path(const char *path, const char *prefix, char *name, int flags,
|
||||
did_one = true;
|
||||
} else if (buflen + 2 + strlen(prefix) + strlen(name) < MAXPATHL) {
|
||||
add_pathsep(buf);
|
||||
STRCAT(buf, prefix);
|
||||
strcat(buf, prefix);
|
||||
tail = buf + strlen(buf);
|
||||
|
||||
// Loop over all patterns in "name"
|
||||
|
@ -2092,7 +2092,7 @@ char *parse_spelllang(win_T *wp)
|
||||
} else {
|
||||
// One entry in 'spellfile'.
|
||||
copy_option_part(&spf, spf_name, MAXPATHL - 5, ",");
|
||||
STRCAT(spf_name, ".spl");
|
||||
strcat(spf_name, ".spl");
|
||||
int c;
|
||||
|
||||
// If it was already found above then skip it.
|
||||
@ -2677,7 +2677,7 @@ void ex_spellrepall(exarg_T *eap)
|
||||
char *p = xmalloc((size_t)get_cursor_line_len() + (size_t)addlen + 1);
|
||||
memmove(p, line, (size_t)curwin->w_cursor.col);
|
||||
STRCPY(p + curwin->w_cursor.col, repl_to);
|
||||
STRCAT(p, line + curwin->w_cursor.col + repl_from_len);
|
||||
strcat(p, line + curwin->w_cursor.col + repl_from_len);
|
||||
ml_replace(curwin->w_cursor.lnum, p, false);
|
||||
inserted_bytes(curwin->w_cursor.lnum, curwin->w_cursor.col,
|
||||
(int)repl_from_len, (int)repl_to_len);
|
||||
@ -3444,14 +3444,14 @@ static void dump_word(slang_T *slang, char *word, char *pat, Direction *dir, int
|
||||
// Add flags and regions after a slash.
|
||||
if ((flags & (WF_BANNED | WF_RARE | WF_REGION)) || keepcap) {
|
||||
STRCPY(badword, p);
|
||||
STRCAT(badword, "/");
|
||||
strcat(badword, "/");
|
||||
if (keepcap) {
|
||||
STRCAT(badword, "=");
|
||||
strcat(badword, "=");
|
||||
}
|
||||
if (flags & WF_BANNED) {
|
||||
STRCAT(badword, "!");
|
||||
strcat(badword, "!");
|
||||
} else if (flags & WF_RARE) {
|
||||
STRCAT(badword, "?");
|
||||
strcat(badword, "?");
|
||||
}
|
||||
if (flags & WF_REGION) {
|
||||
for (int i = 0; i < 7; i++) {
|
||||
|
@ -2140,11 +2140,11 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
||||
+ strlen(items[1]) + 3, false);
|
||||
if (spin->si_info != NULL) {
|
||||
STRCPY(p, spin->si_info);
|
||||
STRCAT(p, "\n");
|
||||
strcat(p, "\n");
|
||||
}
|
||||
STRCAT(p, items[0]);
|
||||
STRCAT(p, " ");
|
||||
STRCAT(p, items[1]);
|
||||
strcat(p, items[0]);
|
||||
strcat(p, " ");
|
||||
strcat(p, items[1]);
|
||||
spin->si_info = p;
|
||||
} else if (is_aff_rule(items, itemcnt, "MIDWORD", 2) && midword == NULL) {
|
||||
midword = getroom_save(spin, items[1]);
|
||||
@ -2200,7 +2200,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
||||
// "Na" into "Na+", "1234" into "1234+".
|
||||
p = getroom(spin, strlen(items[1]) + 2, false);
|
||||
STRCPY(p, items[1]);
|
||||
STRCAT(p, "+");
|
||||
strcat(p, "+");
|
||||
compflags = p;
|
||||
} else if (is_aff_rule(items, itemcnt, "COMPOUNDRULES", 2)) {
|
||||
// We don't use the count, but do check that it's a number and
|
||||
@ -2221,9 +2221,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
||||
p = getroom(spin, (size_t)l, false);
|
||||
if (compflags != NULL) {
|
||||
STRCPY(p, compflags);
|
||||
STRCAT(p, "/");
|
||||
strcat(p, "/");
|
||||
}
|
||||
STRCAT(p, items[1]);
|
||||
strcat(p, items[1]);
|
||||
compflags = p;
|
||||
}
|
||||
} else if (is_aff_rule(items, itemcnt, "COMPOUNDWORDMAX", 2)
|
||||
@ -2844,7 +2844,7 @@ static void process_compflags(spellinfo_T *spin, afffile_T *aff, char *compflags
|
||||
char *p = getroom(spin, (size_t)len, false);
|
||||
if (spin->si_compflags != NULL) {
|
||||
STRCPY(p, spin->si_compflags);
|
||||
STRCAT(p, "/");
|
||||
strcat(p, "/");
|
||||
}
|
||||
spin->si_compflags = p;
|
||||
uint8_t *tp = (uint8_t *)p + strlen(p);
|
||||
@ -3386,7 +3386,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char *afflist, afffile_
|
||||
MB_PTR_ADV(p);
|
||||
}
|
||||
}
|
||||
STRCAT(newword, p);
|
||||
strcat(newword, p);
|
||||
} else {
|
||||
// suffix: chop/add at the end of the word
|
||||
xstrlcpy(newword, word, MAXWLEN);
|
||||
@ -3400,7 +3400,7 @@ static int store_aff_word(spellinfo_T *spin, char *word, char *afflist, afffile_
|
||||
*p = NUL;
|
||||
}
|
||||
if (ae->ae_add != NULL) {
|
||||
STRCAT(newword, ae->ae_add);
|
||||
strcat(newword, ae->ae_add);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,7 +643,7 @@ void spell_suggest(int count)
|
||||
int c = (int)(sug.su_badptr - line);
|
||||
memmove(p, line, (size_t)c);
|
||||
STRCPY(p + c, stp->st_word);
|
||||
STRCAT(p, sug.su_badptr + stp->st_orglen);
|
||||
strcat(p, sug.su_badptr + stp->st_orglen);
|
||||
|
||||
// For redo we use a change-word command.
|
||||
ResetRedobuff();
|
||||
@ -1638,7 +1638,7 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
|
||||
|
||||
// Append a space to preword when splitting.
|
||||
if (!try_compound && !fword_ends) {
|
||||
STRCAT(preword, " ");
|
||||
strcat(preword, " ");
|
||||
}
|
||||
sp->ts_prewordlen = (uint8_t)strlen(preword);
|
||||
sp->ts_splitoff = sp->ts_twordlen;
|
||||
|
@ -4992,7 +4992,7 @@ static int get_id_list(char **const arg, const int keylen, int16_t **const list,
|
||||
} else {
|
||||
// Handle match of regexp with group names.
|
||||
*name = '^';
|
||||
STRCAT(name, "$");
|
||||
strcat(name, "$");
|
||||
regmatch.regprog = vim_regcomp(name, RE_MAGIC);
|
||||
if (regmatch.regprog == NULL) {
|
||||
failed = true;
|
||||
|
@ -1060,7 +1060,7 @@ static int add_llist_tags(char *tag, int num_matches, char **matches)
|
||||
|
||||
// Precede the tag pattern with \V to make it very
|
||||
// nomagic.
|
||||
STRCAT(cmd, "\\V");
|
||||
strcat(cmd, "\\V");
|
||||
len += 2;
|
||||
|
||||
int cmd_len = (int)(cmd_end - cmd_start + 1);
|
||||
|
@ -1274,9 +1274,9 @@ static size_t add_cmd_modifier(char *buf, char *mod_str, bool *multi_mods)
|
||||
|
||||
if (buf != NULL) {
|
||||
if (*multi_mods) {
|
||||
STRCAT(buf, " ");
|
||||
strcat(buf, " ");
|
||||
}
|
||||
STRCAT(buf, mod_str);
|
||||
strcat(buf, mod_str);
|
||||
}
|
||||
|
||||
*multi_mods = true;
|
||||
|
Loading…
Reference in New Issue
Block a user