diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-06-11 19:21:50 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-11 19:21:50 +0200 |
commit | 39d8651283c0458c20b755d2140c8a3cb7b581c5 (patch) | |
tree | e023eb5f914c1928bc885093db9fd6d952c65d7d | |
parent | c37695a5d5f2e8914fff86f3581bed70b4c85d3c (diff) | |
parent | bbd2f340a2895ed59785f952b2585e6590602cad (diff) | |
download | rneovim-39d8651283c0458c20b755d2140c8a3cb7b581c5.tar.gz rneovim-39d8651283c0458c20b755d2140c8a3cb7b581c5.tar.bz2 rneovim-39d8651283c0458c20b755d2140c8a3cb7b581c5.zip |
Merge pull request #29278 from bfredl/strcat
refactor(memory): use builtin strcat() instead of STRCAT()
-rwxr-xr-x | src/clint.py | 2 | ||||
-rw-r--r-- | src/nvim/autocmd.c | 2 | ||||
-rw-r--r-- | src/nvim/change.c | 4 | ||||
-rw-r--r-- | src/nvim/cmdexpand.c | 2 | ||||
-rw-r--r-- | src/nvim/diff.c | 6 | ||||
-rw-r--r-- | src/nvim/eval.c | 4 | ||||
-rw-r--r-- | src/nvim/eval/userfunc.c | 4 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 12 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 6 | ||||
-rw-r--r-- | src/nvim/ex_eval.c | 4 | ||||
-rw-r--r-- | src/nvim/file_search.c | 10 | ||||
-rw-r--r-- | src/nvim/fold.c | 2 | ||||
-rw-r--r-- | src/nvim/insexpand.c | 2 | ||||
-rw-r--r-- | src/nvim/memory.h | 2 | ||||
-rw-r--r-- | src/nvim/menu.c | 2 | ||||
-rw-r--r-- | src/nvim/normal.c | 2 | ||||
-rw-r--r-- | src/nvim/ops.c | 6 | ||||
-rw-r--r-- | src/nvim/option.c | 6 | ||||
-rw-r--r-- | src/nvim/os/shell.c | 26 | ||||
-rw-r--r-- | src/nvim/path.c | 4 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 4 | ||||
-rw-r--r-- | src/nvim/regexp.c | 2 | ||||
-rw-r--r-- | src/nvim/runtime.c | 2 | ||||
-rw-r--r-- | src/nvim/spell.c | 12 | ||||
-rw-r--r-- | src/nvim/spellfile.c | 20 | ||||
-rw-r--r-- | src/nvim/spellsuggest.c | 4 | ||||
-rw-r--r-- | src/nvim/syntax.c | 2 | ||||
-rw-r--r-- | src/nvim/tag.c | 2 | ||||
-rw-r--r-- | src/nvim/usercmd.c | 4 |
29 files changed, 79 insertions, 81 deletions
diff --git a/src/clint.py b/src/clint.py index 41058469b1..051f0e91e5 100755 --- a/src/clint.py +++ b/src/clint.py @@ -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)) diff --git a/src/nvim/autocmd.c b/src/nvim/autocmd.c index 37aa946aaf..ebed3e6f03 100644 --- a/src/nvim/autocmd.c +++ b/src/nvim/autocmd.c @@ -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); diff --git a/src/nvim/change.c b/src/nvim/change.c index 05772d39e9..6c979df1fe 100644 --- a/src/nvim/change.c +++ b/src/nvim/change.c @@ -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; diff --git a/src/nvim/cmdexpand.c b/src/nvim/cmdexpand.c index d8081ddfac..fdb452aee4 100644 --- a/src/nvim/cmdexpand.c +++ b/src/nvim/cmdexpand.c @@ -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; diff --git a/src/nvim/diff.c b/src/nvim/diff.c index e24c39e60c..750f0c3525 100644 --- a/src/nvim/diff.c +++ b/src/nvim/diff.c @@ -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 diff --git a/src/nvim/eval.c b/src/nvim/eval.c index df5d336cbd..4cff5e1582 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -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); diff --git a/src/nvim/eval/userfunc.c b/src/nvim/eval/userfunc.c index 00fb896797..122a1ac8ab 100644 --- a/src/nvim/eval/userfunc.c +++ b/src/nvim/eval/userfunc.c @@ -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; } diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index 234ab59844..7858e44f17 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -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; diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index a38ff6333a..9a6a845958 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -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; diff --git a/src/nvim/ex_eval.c b/src/nvim/ex_eval.c index 0b2e1f9294..0f4f31df02 100644 --- a/src/nvim/ex_eval.c +++ b/src/nvim/ex_eval.c @@ -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] = '"'; diff --git a/src/nvim/file_search.c b/src/nvim/file_search.c index ef936abab5..50031eedee 100644 --- a/src/nvim/file_search.c +++ b/src/nvim/file_search.c @@ -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, diff --git a/src/nvim/fold.c b/src/nvim/fold.c index be1b6acf2c..78fe33cc78 100644 --- a/src/nvim/fold.c +++ b/src/nvim/fold.c @@ -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; diff --git a/src/nvim/insexpand.c b/src/nvim/insexpand.c index 574c9a9e3a..711e2292b1 100644 --- a/src/nvim/insexpand.c +++ b/src/nvim/insexpand.c @@ -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, "\\<"); diff --git a/src/nvim/memory.h b/src/nvim/memory.h index 0788670142..277ffe97aa 100644 --- a/src/nvim/memory.h +++ b/src/nvim/memory.h @@ -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) diff --git a/src/nvim/menu.c b/src/nvim/menu.c index fb4618260f..aa76b8010d 100644 --- a/src/nvim/menu.c +++ b/src/nvim/menu.c @@ -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) { diff --git a/src/nvim/normal.c b/src/nvim/normal.c index 879131c9e8..3343803bb1 100644 --- a/src/nvim/normal.c +++ b/src/nvim/normal.c @@ -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; diff --git a/src/nvim/ops.c b/src/nvim/ops.c index 1448896146..8f8baaf619 100644 --- a/src/nvim/ops.c +++ b/src/nvim/ops.c @@ -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) { diff --git a/src/nvim/option.c b/src/nvim/option.c index a07fc16847..4c68e2bf16 100644 --- a/src/nvim/option.c +++ b/src/nvim/option.c @@ -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); diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c index b66faa2285..4b34ed1c4e 100644 --- a/src/nvim/os/shell.c +++ b/src/nvim/os/shell.c @@ -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 diff --git a/src/nvim/path.c b/src/nvim/path.c index d782d1a989..aa630038a8 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -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; diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index be2f41da14..ed3fd83fd5 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -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++) { diff --git a/src/nvim/regexp.c b/src/nvim/regexp.c index ad3cce9120..e00dbdfc78 100644 --- a/src/nvim/regexp.c +++ b/src/nvim/regexp.c @@ -11451,7 +11451,7 @@ static void nfa_set_code(int c) } if (addnl == true) { - STRCAT(code, " + NEWLINE "); + strcat(code, " + NEWLINE "); } } diff --git a/src/nvim/runtime.c b/src/nvim/runtime.c index 2fd794e4a6..6728262432 100644 --- a/src/nvim/runtime.c +++ b/src/nvim/runtime.c @@ -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" diff --git a/src/nvim/spell.c b/src/nvim/spell.c index 39145d73ed..8ec28c7f61 100644 --- a/src/nvim/spell.c +++ b/src/nvim/spell.c @@ -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++) { diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c index aa7f9ba3d7..3feae980c5 100644 --- a/src/nvim/spellfile.c +++ b/src/nvim/spellfile.c @@ -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); } } diff --git a/src/nvim/spellsuggest.c b/src/nvim/spellsuggest.c index bdfcb3fca4..436599bb13 100644 --- a/src/nvim/spellsuggest.c +++ b/src/nvim/spellsuggest.c @@ -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; diff --git a/src/nvim/syntax.c b/src/nvim/syntax.c index 24363008c1..538863326c 100644 --- a/src/nvim/syntax.c +++ b/src/nvim/syntax.c @@ -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; diff --git a/src/nvim/tag.c b/src/nvim/tag.c index a355e03194..1d318fc3c7 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -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); diff --git a/src/nvim/usercmd.c b/src/nvim/usercmd.c index 7856fcd0ba..877624b07e 100644 --- a/src/nvim/usercmd.c +++ b/src/nvim/usercmd.c @@ -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; |