summaryrefslogtreecommitdiff
path: root/src/spellfile.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-11-07 20:48:42 +0100
committerBram Moolenaar <Bram@vim.org>2019-11-07 20:48:42 +0100
commit3d2a47c7823b934e1a85d773b68758c87c3ddc90 (patch)
tree54b3cbccf57dc11d61d01b9ca18cd1cf21eb593c /src/spellfile.c
parent3b991527e8167f25ad1dfe780b9633c153600955 (diff)
downloadvim-git-3d2a47c7823b934e1a85d773b68758c87c3ddc90.tar.gz
patch 8.1.2268: spell file flag zero is not recognizedv8.1.2268
Problem: Spell file flag zero is not recognized. Solution: Use -1 as an error value, so that zero can be used as a valid flag number.
Diffstat (limited to 'src/spellfile.c')
-rw-r--r--src/spellfile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/spellfile.c b/src/spellfile.c
index f34d9badb..4b364421d 100644
--- a/src/spellfile.c
+++ b/src/spellfile.c
@@ -260,6 +260,8 @@
* follow; never used in prefix tree */
#define BY_SPECIAL BY_FLAGS2 /* highest special byte value */
+#define ZERO_FLAG 65009 // used when flag is zero: "0"
+
/* Flags used in .spl file for soundsalike flags. */
#define SAL_F0LLOWUP 1
#define SAL_COLLAPSE 2
@@ -3182,6 +3184,7 @@ affitem2flag(
/*
* Get one affix name from "*pp" and advance the pointer.
+ * Returns ZERO_FLAG for "0".
* Returns zero for an error, still advances the pointer then.
*/
static unsigned
@@ -3197,6 +3200,8 @@ get_affitem(int flagtype, char_u **pp)
return 0;
}
res = getdigits(pp);
+ if (res == 0)
+ res = ZERO_FLAG;
}
else
{
@@ -3343,6 +3348,8 @@ flag_in_afflist(int flagtype, char_u *afflist, unsigned flag)
for (p = afflist; *p != NUL; )
{
n = getdigits(&p);
+ if (n == 0)
+ n = ZERO_FLAG;
if (n == flag)
return TRUE;
if (*p != NUL) /* skip over comma */