aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/spellfile.c
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2023-08-13 10:29:43 +0100
committerLewis Russell <me@lewisr.dev>2023-08-31 15:12:35 +0100
commita1bec02c1e105eb9f49d577e04bdbeadd5a05e38 (patch)
tree894faacc22be90a78ba9c7d4ae9072782d465439 /src/nvim/spellfile.c
parentdd0e77d48a843fc9730fe4ef7567330daf8dfb81 (diff)
downloadrneovim-a1bec02c1e105eb9f49d577e04bdbeadd5a05e38.tar.gz
rneovim-a1bec02c1e105eb9f49d577e04bdbeadd5a05e38.tar.bz2
rneovim-a1bec02c1e105eb9f49d577e04bdbeadd5a05e38.zip
fix: use snprintf instead of sprintf
Clang 14 now reports sprintf as deprecated.
Diffstat (limited to 'src/nvim/spellfile.c')
-rw-r--r--src/nvim/spellfile.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/nvim/spellfile.c b/src/nvim/spellfile.c
index 3337169199..d7dc7fb672 100644
--- a/src/nvim/spellfile.c
+++ b/src/nvim/spellfile.c
@@ -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);
}