mirror of
https://github.com/neovim/neovim.git
synced 2025-10-03 16:36:30 +00:00
fix: use snprintf instead of sprintf
Clang 14 now reports sprintf as deprecated.
This commit is contained in:

committed by
Lewis Russell

parent
dd0e77d48a
commit
a1bec02c1e
@@ -2472,11 +2472,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
||||
char buf[MAXLINELEN];
|
||||
|
||||
aff_entry->ae_cond = getroom_save(spin, items[4]);
|
||||
if (*items[0] == 'P') {
|
||||
sprintf(buf, "^%s", items[4]); // NOLINT(runtime/printf)
|
||||
} else {
|
||||
sprintf(buf, "%s$", items[4]); // NOLINT(runtime/printf)
|
||||
}
|
||||
snprintf(buf, sizeof(buf), *items[0] == 'P' ? "^%s" : "%s$", items[4]);
|
||||
aff_entry->ae_prog = vim_regcomp(buf, RE_MAGIC + RE_STRING + RE_STRICT);
|
||||
if (aff_entry->ae_prog == NULL) {
|
||||
smsg(_("Broken condition in %s line %d: %s"),
|
||||
@@ -2520,7 +2516,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char *fname)
|
||||
onecap_copy(items[4], buf, true);
|
||||
aff_entry->ae_cond = getroom_save(spin, buf);
|
||||
if (aff_entry->ae_cond != NULL) {
|
||||
sprintf(buf, "^%s", aff_entry->ae_cond); // NOLINT(runtime/printf)
|
||||
snprintf(buf, MAXLINELEN, "^%s", aff_entry->ae_cond);
|
||||
vim_regfree(aff_entry->ae_prog);
|
||||
aff_entry->ae_prog = vim_regcomp(buf, RE_MAGIC + RE_STRING);
|
||||
}
|
||||
|
Reference in New Issue
Block a user