aboutsummaryrefslogtreecommitdiff
path: root/src/spell.c
diff options
context:
space:
mode:
authorMarco Hinz <mh.codebro@gmail.com>2014-04-29 21:56:49 +0200
committerThiago de Arruda <tpadilha84@gmail.com>2014-04-29 17:51:09 -0300
commit2e4613aecc712eb5e893d341da5f571f932376d5 (patch)
tree41f6b1c751181319d88cc0fdb7aed61bf732701d /src/spell.c
parent046debb9359c85e2f2bc5c6d9481dac0025c6a80 (diff)
downloadrneovim-2e4613aecc712eb5e893d341da5f571f932376d5.tar.gz
rneovim-2e4613aecc712eb5e893d341da5f571f932376d5.tar.bz2
rneovim-2e4613aecc712eb5e893d341da5f571f932376d5.zip
Remove NUL macro
Diffstat (limited to 'src/spell.c')
-rw-r--r--src/spell.c520
1 files changed, 260 insertions, 260 deletions
diff --git a/src/spell.c b/src/spell.c
index b948aed530..59285db5a2 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -1018,7 +1018,7 @@ spell_check (
if (spell_iswordp(mi.mi_fend, wp)) {
do {
mb_ptr_adv(mi.mi_fend);
- } while (*mi.mi_fend != NUL && spell_iswordp(mi.mi_fend, wp));
+ } while (*mi.mi_fend != '\0' && spell_iswordp(mi.mi_fend, wp));
if (capcol != NULL && *capcol == 0 && wp->w_s->b_cap_prog != NULL) {
// Check word starting with capital letter.
@@ -1041,7 +1041,7 @@ spell_check (
// case-fold the word with one non-word character, so that we can check
// for the word end.
- if (*mi.mi_fend != NUL)
+ if (*mi.mi_fend != '\0')
mb_ptr_adv(mi.mi_fend);
(void)spell_casefold(ptr, (int)(mi.mi_fend - ptr), mi.mi_fword,
@@ -1226,7 +1226,7 @@ static void find_word(matchinf_T *mip, int mode)
// - we reach the end of the tree,
// - or we reach the end of the line.
for (;; ) {
- if (flen <= 0 && *mip->mi_fend != NUL)
+ if (flen <= 0 && *mip->mi_fend != '\0')
flen = fold_more(mip);
len = byts[arridx++];
@@ -1254,7 +1254,7 @@ static void find_word(matchinf_T *mip, int mode)
}
// Stop looking at end of the line.
- if (ptr[wlen] == NUL)
+ if (ptr[wlen] == '\0')
break;
// Perform a binary search in the list of accepted bytes.
@@ -1288,7 +1288,7 @@ static void find_word(matchinf_T *mip, int mode)
// checked word.
if (c == ' ') {
for (;; ) {
- if (flen <= 0 && *mip->mi_fend != NUL)
+ if (flen <= 0 && *mip->mi_fend != '\0')
flen = fold_more(mip);
if (ptr[wlen] != ' ' && ptr[wlen] != TAB)
break;
@@ -1459,7 +1459,7 @@ static void find_word(matchinf_T *mip, int mode)
// words must match with one of the COMPOUNDRULE items and
// the number of syllables must not be too large.
mip->mi_compflags[mip->mi_complen] = ((unsigned)flags >> 24);
- mip->mi_compflags[mip->mi_complen + 1] = NUL;
+ mip->mi_compflags[mip->mi_complen + 1] = '\0';
if (word_ends) {
char_u fword[MAXWLEN];
@@ -1649,9 +1649,9 @@ static int can_compound(slang_T *slang, char_u *word, char_u *flags)
if (enc_utf8) {
// Need to convert the single byte flags to utf8 characters.
p = uflags;
- for (i = 0; flags[i] != NUL; ++i)
+ for (i = 0; flags[i] != '\0'; ++i)
p += mb_char2bytes(flags[i], p);
- *p = NUL;
+ *p = '\0';
p = uflags;
} else
p = flags;
@@ -1687,9 +1687,9 @@ static int can_be_compound(trystate_T *sp, slang_T *slang, char_u *compflags, in
int v;
compflags[sp->ts_complen] = flag;
- compflags[sp->ts_complen + 1] = NUL;
+ compflags[sp->ts_complen + 1] = '\0';
v = match_compoundrule(slang, compflags + sp->ts_compsplit);
- compflags[sp->ts_complen] = NUL;
+ compflags[sp->ts_complen] = '\0';
return v;
}
@@ -1708,22 +1708,22 @@ static int match_compoundrule(slang_T *slang, char_u *compflags)
int c;
// loop over all the COMPOUNDRULE entries
- for (p = slang->sl_comprules; *p != NUL; ++p) {
+ for (p = slang->sl_comprules; *p != '\0'; ++p) {
// loop over the flags in the compound word we have made, match
// them against the current rule entry
for (i = 0;; ++i) {
c = compflags[i];
- if (c == NUL)
+ if (c == '\0')
// found a rule that matches for the flags we have so far
return TRUE;
- if (*p == '/' || *p == NUL)
+ if (*p == '/' || *p == '\0')
break; // end of rule, it's too short
if (*p == '[') {
int match = FALSE;
// compare against all the flags in []
++p;
- while (*p != ']' && *p != NUL)
+ while (*p != ']' && *p != '\0')
if (*p++ == c)
match = TRUE;
if (!match)
@@ -1833,7 +1833,7 @@ static void find_prefix(matchinf_T *mip, int mode)
// - we reach the end of the tree,
// - or we reach the end of the line.
for (;; ) {
- if (flen == 0 && *mip->mi_fend != NUL)
+ if (flen == 0 && *mip->mi_fend != '\0')
flen = fold_more(mip);
len = byts[arridx++];
@@ -1873,7 +1873,7 @@ static void find_prefix(matchinf_T *mip, int mode)
}
// Stop looking at end of the line.
- if (ptr[wlen] == NUL)
+ if (ptr[wlen] == '\0')
break;
// Perform a binary search in the list of accepted bytes.
@@ -1914,10 +1914,10 @@ static int fold_more(matchinf_T *mip)
p = mip->mi_fend;
do {
mb_ptr_adv(mip->mi_fend);
- } while (*mip->mi_fend != NUL && spell_iswordp(mip->mi_fend, mip->mi_win));
+ } while (*mip->mi_fend != '\0' && spell_iswordp(mip->mi_fend, mip->mi_win));
// Include the non-word character so that we can check for the word end.
- if (*mip->mi_fend != NUL)
+ if (*mip->mi_fend != '\0')
mb_ptr_adv(mip->mi_fend);
(void)spell_casefold(p, (int)(mip->mi_fend - p),
@@ -1945,7 +1945,7 @@ spell_valid_case (
// Return TRUE if spell checking is not enabled.
static int no_spell_checking(win_T *wp)
{
- if (!wp->w_p_spell || *wp->w_s->b_p_spl == NUL
+ if (!wp->w_p_spell || *wp->w_s->b_p_spl == '\0'
|| wp->w_s->b_langp.ga_len == 0) {
EMSG(_("E756: Spell checking is not enabled"));
return TRUE;
@@ -2161,7 +2161,7 @@ spell_move_to (
--capcol;
// But after empty line check first word in next line
- if (*skipwhite(line) == NUL)
+ if (*skipwhite(line) == '\0')
capcol = 0;
}
@@ -2185,7 +2185,7 @@ void spell_cat_line(char_u *buf, char_u *line, int maxlen)
while (vim_strchr((char_u *)"*#/\"\t", *p) != NULL)
p = skipwhite(p + 1);
- if (*p != NUL) {
+ if (*p != '\0') {
// Only worth concatenating if there is something else than spaces to
// concatenate.
n = (int)(p - line) + 1;
@@ -2227,14 +2227,14 @@ static void spell_load_lang(char_u *lang)
lang, spell_enc());
r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
- if (r == FAIL && *sl.sl_lang != NUL) {
+ if (r == FAIL && *sl.sl_lang != '\0') {
// Try loading the ASCII version.
vim_snprintf((char *)fname_enc, sizeof(fname_enc) - 5,
"spell/%s.ascii.spl",
lang);
r = do_in_runtimepath(fname_enc, FALSE, spell_load_cb, &sl);
- if (r == FAIL && *sl.sl_lang != NUL && round == 1
+ if (r == FAIL && *sl.sl_lang != '\0' && round == 1
&& apply_autocmds(EVENT_SPELLFILEMISSING, lang,
curbuf->b_fname, FALSE, curbuf))
continue;
@@ -2389,7 +2389,7 @@ static void slang_clear(slang_T *lp)
lp->sl_compmax = MAXWLEN;
lp->sl_compminlen = 0;
lp->sl_compsylmax = MAXWLEN;
- lp->sl_regions[0] = NUL;
+ lp->sl_regions[0] = '\0';
}
// Clear the info from the .sug file in "lp".
@@ -2649,7 +2649,7 @@ truncerr:
endFAIL:
if (lang != NULL)
// truncating the name signals the error to spell_load_lang()
- *lang = NUL;
+ *lang = '\0';
if (lp != NULL && old_lp == NULL)
slang_free(lp);
lp = NULL;
@@ -2701,7 +2701,7 @@ static int read_region_section(FILE *fd, slang_T *lp, int len)
return SP_FORMERROR;
for (i = 0; i < len; ++i)
lp->sl_regions[i] = getc(fd); // <regionname>
- lp->sl_regions[len] = NUL;
+ lp->sl_regions[len] = '\0';
return 0;
}
@@ -2770,7 +2770,7 @@ static int read_prefcond_section(FILE *fd, slang_T *lp)
p = buf + 1;
while (n-- > 0)
*p++ = getc(fd); // <condstr>
- *p = NUL;
+ *p = '\0';
lp->sl_prefprog[i] = vim_regcomp(buf, RE_MAGIC + RE_STRING);
}
}
@@ -2829,7 +2829,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
salitem_T *smp;
int ccnt;
char_u *p;
- int c = NUL;
+ int c = '\0';
slang->sl_sofo = FALSE;
@@ -2866,7 +2866,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
*p++ = c;
}
smp->sm_leadlen = (int)(p - smp->sm_lead);
- *p++ = NUL;
+ *p++ = '\0';
// Put (abc) chars in sm_oneof, if any.
if (c == '(') {
@@ -2877,7 +2877,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
break;
*p++ = c;
}
- *p++ = NUL;
+ *p++ = '\0';
if (++i < ccnt)
c = getc(fd);
} else
@@ -2890,7 +2890,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
*p++ = c;
for (++i; i < ccnt; ++i)
*p++ = getc(fd); // <salfrom>
- *p++ = NUL;
+ *p++ = '\0';
// <saltolen> <salto>
smp->sm_to = read_cnt_string(fd, 1, &ccnt);
@@ -2919,7 +2919,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
// that we need to check the index every time.
smp = &((salitem_T *)gap->ga_data)[gap->ga_len];
p = alloc(1);
- p[0] = NUL;
+ p[0] = '\0';
smp->sm_lead = p;
smp->sm_leadlen = 0;
smp->sm_oneof = NULL;
@@ -2956,7 +2956,7 @@ static int read_words_section(FILE *fd, slang_T *lp, int len)
if (c == EOF)
return SP_TRUNCERROR;
word[i] = c;
- if (word[i] == NUL)
+ if (word[i] == '\0')
break;
if (i == MAXWLEN - 1)
return SP_FORMERROR;
@@ -3151,11 +3151,11 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
// for all flags.
cp = alloc(todo + 1);
slang->sl_compstartflags = cp;
- *cp = NUL;
+ *cp = '\0';
ap = alloc(todo + 1);
slang->sl_compallflags = ap;
- *ap = NUL;
+ *ap = '\0';
// And a list of all patterns in their original form, for checking whether
// compounding may work in match_compoundrule(). This is freed when we
@@ -3180,7 +3180,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
if (vim_strchr((char_u *)"?*+[]/", c) == NULL
&& !byte_in_str(slang->sl_compallflags, c)) {
*ap++ = c;
- *ap = NUL;
+ *ap = '\0';
}
if (atstart != 0) {
@@ -3193,7 +3193,7 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
else {
if (!byte_in_str(slang->sl_compstartflags, c)) {
*cp++ = c;
- *cp = NUL;
+ *cp = '\0';
}
if (atstart == 1)
atstart = 0;
@@ -3227,10 +3227,10 @@ static int read_compound(FILE *fd, slang_T *slang, int len)
*pp++ = '\\';
*pp++ = ')';
*pp++ = '$';
- *pp = NUL;
+ *pp = '\0';
if (crp != NULL)
- *crp = NUL;
+ *crp = '\0';
slang->sl_compprog = vim_regcomp(pat, RE_MAGIC + RE_STRING + RE_STRICT);
vim_free(pat);
@@ -3246,7 +3246,7 @@ static int byte_in_str(char_u *str, int n)
{
char_u *p;
- for (p = str; *p != NUL; ++p)
+ for (p = str; *p != '\0'; ++p)
if (*p == n)
return TRUE;
return FALSE;
@@ -3270,8 +3270,8 @@ static int init_syl_tab(slang_T *slang)
ga_init(&slang->sl_syl_items, sizeof(syl_item_T), 4);
p = vim_strchr(slang->sl_syllable, '/');
while (p != NULL) {
- *p++ = NUL;
- if (*p == NUL) // trailing slash
+ *p++ = '\0';
+ if (*p == '\0') // trailing slash
break;
s = p;
p = vim_strchr(p, '/');
@@ -3306,7 +3306,7 @@ static int count_syllables(slang_T *slang, char_u *word)
if (slang->sl_syllable == NULL)
return 0;
- for (p = word; *p != NUL; p += len) {
+ for (p = word; *p != '\0'; p += len) {
// When running into a space reset counter.
if (*p == ' ') {
len = 1;
@@ -3365,13 +3365,13 @@ static int set_sofo(slang_T *lp, char_u *from, char_u *to)
// First count the number of items for each list. Temporarily use
// sl_sal_first[] for this.
- for (p = from, s = to; *p != NUL && *s != NUL; ) {
+ for (p = from, s = to; *p != '\0' && *s != '\0'; ) {
c = mb_cptr2char_adv(&p);
mb_cptr_adv(s);
if (c >= 256)
++lp->sl_sal_first[c & 0xff];
}
- if (*p != NUL || *s != NUL) // lengths differ
+ if (*p != '\0' || *s != '\0') // lengths differ
return SP_FORMERROR;
// Allocate the lists.
@@ -3385,7 +3385,7 @@ static int set_sofo(slang_T *lp, char_u *from, char_u *to)
// Put the characters up to 255 in sl_sal_first[] the rest in a sl_sal
// list.
memset(lp->sl_sal_first, 0, sizeof(salfirst_T) * 256);
- for (p = from, s = to; *p != NUL && *s != NUL; ) {
+ for (p = from, s = to; *p != '\0' && *s != '\0'; ) {
c = mb_cptr2char_adv(&p);
i = mb_cptr2char_adv(&s);
if (c >= 256) {
@@ -3396,7 +3396,7 @@ static int set_sofo(slang_T *lp, char_u *from, char_u *to)
++inp;
*inp++ = c; // from char
*inp++ = i; // to char
- *inp++ = NUL; // NUL at the end
+ *inp++ = '\0'; // NUL at the end
} else
// mapping byte to char is done in sl_sal_first[]
lp->sl_sal_first[c] = i;
@@ -3406,7 +3406,7 @@ static int set_sofo(slang_T *lp, char_u *from, char_u *to)
if (STRLEN(from) != STRLEN(to))
return SP_FORMERROR;
- for (i = 0; to[i] != NUL; ++i)
+ for (i = 0; to[i] != '\0'; ++i)
lp->sl_sal_first[from[i]] = to[i];
lp->sl_sal.ga_len = 1; // indicates we have soundfolding
}
@@ -3473,9 +3473,9 @@ static int *mb_str2wide(char_u *s)
int i = 0;
int *res = xmalloc((mb_charlen(s) + 1) * sizeof(int));
- for (char_u *p = s; *p != NUL; )
+ for (char_u *p = s; *p != '\0'; )
res[i++] = mb_ptr2char_adv(&p);
- res[i] = NUL;
+ res[i] = '\0';
return res;
}
@@ -3675,7 +3675,7 @@ char_u *did_set_spelllang(win_T *wp)
wp->w_s->b_cjk = 0;
// Loop over comma separated language names.
- for (splp = spl_copy; *splp != NUL; ) {
+ for (splp = spl_copy; *splp != '\0'; ) {
// Get one language name.
copy_option_part(&splp, lang, MAXWLEN, ",");
region = NULL;
@@ -3712,7 +3712,7 @@ char_u *did_set_spelllang(win_T *wp)
if (len > 3 && lang[len - 3] == '_') {
region = lang + len - 2;
len -= 3;
- lang[len] = NUL;
+ lang[len] = '\0';
} else
dont_use_region = TRUE;
@@ -3756,7 +3756,7 @@ char_u *did_set_spelllang(win_T *wp)
c = find_region(slang->sl_regions, region);
if (c == REGION_ALL) {
if (slang->sl_add) {
- if (*slang->sl_regions != NUL)
+ if (*slang->sl_regions != '\0')
// This addition file is for other regions.
region_mask = 0;
} else
@@ -3786,7 +3786,7 @@ char_u *did_set_spelllang(win_T *wp)
// round 2: load second name in 'spellfile.
// etc.
spf = curwin->w_s->b_p_spf;
- for (round = 0; round == 0 || *spf != NUL; ++round) {
+ for (round = 0; round == 0 || *spf != '\0'; ++round) {
if (round == 0) {
// Internal wordlist, if there is one.
if (int_wordlist == NULL)
@@ -3821,7 +3821,7 @@ char_u *did_set_spelllang(win_T *wp)
vim_strncpy(lang, path_tail(spf_name), MAXWLEN);
p = vim_strchr(lang, '.');
if (p != NULL)
- *p = NUL; // truncate at ".encoding.add"
+ *p = '\0'; // truncate at ".encoding.add"
}
slang = spell_load_file(spf_name, lang, NULL, TRUE);
@@ -3838,7 +3838,7 @@ char_u *did_set_spelllang(win_T *wp)
c = find_region(slang->sl_regions, use_region);
if (c != REGION_ALL)
region_mask = 1 << c;
- else if (*slang->sl_regions != NUL)
+ else if (*slang->sl_regions != '\0')
// This spell file is for other regions.
region_mask = 0;
}
@@ -3920,7 +3920,7 @@ static void use_midword(slang_T *lp, win_T *wp)
if (lp->sl_midword == NULL) // there aren't any
return;
- for (p = lp->sl_midword; *p != NUL; )
+ for (p = lp->sl_midword; *p != '\0'; )
if (has_mbyte) {
int c, l, n;
char_u *bp;
@@ -3955,7 +3955,7 @@ static int find_region(char_u *rp, char_u *region)
int i;
for (i = 0;; i += 2) {
- if (rp[i] == NUL)
+ if (rp[i] == '\0')
return REGION_ALL;
if (rp[i] == region[0] && rp[i + 1] == region[1])
break;
@@ -3982,7 +3982,7 @@ captype (
// find first letter
for (p = word; !spell_iswordp_nmw(p, curwin); mb_ptr_adv(p))
- if (end == NULL ? *p == NUL : p >= end)
+ if (end == NULL ? *p == '\0' : p >= end)
return 0; // only non-word characters, illegal word
if (has_mbyte)
c = mb_ptr2char_adv(&p);
@@ -3992,7 +3992,7 @@ captype (
// Need to check all letters to find a word with mixed upper/lower.
// But a word with an upper char only at start is a ONECAP.
- for (; end == NULL ? *p != NUL : p < end; mb_ptr_adv(p))
+ for (; end == NULL ? *p != '\0' : p < end; mb_ptr_adv(p))
if (spell_iswordp_nmw(p, curwin)) {
c = PTR2CHAR(p);
if (!SPELL_ISUPPER(c)) {
@@ -4107,7 +4107,7 @@ void spell_reload(void)
for (wp = firstwin; wp != NULL; wp = wp->w_next) {
// Only load the wordlists when 'spelllang' is set and there is a
// window for this buffer in which 'spell' is set.
- if (*wp->w_s->b_p_spl != NUL) {
+ if (*wp->w_s->b_p_spl != '\0') {
if (wp->w_p_spell) {
(void)did_set_spelllang(wp);
break;
@@ -4457,7 +4457,7 @@ static void spell_print_node(wordnode_T *node, int depth)
} else {
node->wn_u1.index = TRUE;
- if (node->wn_byte != NUL) {
+ if (node->wn_byte != '\0') {
if (node->wn_child != NULL)
PRINTSOME(line1, depth, " %c -> ", node->wn_byte, 0);
else
@@ -4473,14 +4473,14 @@ static void spell_print_node(wordnode_T *node, int depth)
else
PRINTSOME(line3, depth, " ", 0, 0);
- if (node->wn_byte == NUL) {
+ if (node->wn_byte == '\0') {
msg(line1);
msg(line2);
msg(line3);
}
// do the children
- if (node->wn_byte != NUL && node->wn_child != NULL)
+ if (node->wn_byte != '\0' && node->wn_child != NULL)
spell_print_node(node->wn_child, depth + 1);
// do the siblings
@@ -4606,9 +4606,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// item.
itemcnt = 0;
for (p = line;; ) {
- while (*p != NUL && *p <= ' ') // skip white space and CR/NL
+ while (*p != '\0' && *p <= ' ') // skip white space and CR/NL
++p;
- if (*p == NUL)
+ if (*p == '\0')
break;
if (itemcnt == MAXITEMCNT) // too many items
break;
@@ -4620,9 +4620,9 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
else
while (*p > ' ') // skip until white space or CR/NL
++p;
- if (*p == NUL)
+ if (*p == '\0')
break;
- *p++ = NUL;
+ *p++ = '\0';
}
// Handle non-empty lines.
@@ -4754,7 +4754,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
fname, lnum, items[1]);
} else if (is_aff_rule(items, itemcnt, "COMPOUNDRULE", 2)) {
// Don't use the first rule if it is a number.
- if (compflags != NULL || *skipdigits(items[1]) != NUL) {
+ if (compflags != NULL || *skipdigits(items[1]) != '\0') {
// Concatenate this string to previously defined ones,
// using a slash to separate them.
l = (int)STRLEN(items[1]) + 1;
@@ -4948,7 +4948,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
// Recognize flags on the affix: abcd/XYZ
aff_entry->ae_flags = vim_strchr(aff_entry->ae_add, '/');
if (aff_entry->ae_flags != NULL) {
- *aff_entry->ae_flags++ = NUL;
+ *aff_entry->ae_flags++ = '\0';
aff_process_flags(aff, aff_entry);
}
}
@@ -4989,7 +4989,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (aff_entry->ae_chop != NULL
&& aff_entry->ae_add != NULL
&& aff_entry->ae_chop[(*mb_ptr2len)(
- aff_entry->ae_chop)] == NUL
+ aff_entry->ae_chop)] == '\0'
) {
int c, c_up;
@@ -5004,7 +5004,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (PTR2CHAR(p) == c_up) {
upper = TRUE;
aff_entry->ae_chop = NULL;
- *p = NUL;
+ *p = '\0';
// The condition is matched with the
// actual word, thus must check for the
@@ -5107,10 +5107,10 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
if (items[0][3] == 'S' ? do_repsal : do_rep) {
// Replace underscore with space (can't include a space
// directly).
- for (p = items[1]; *p != NUL; mb_ptr_adv(p))
+ for (p = items[1]; *p != '\0'; mb_ptr_adv(p))
if (*p == '_')
*p = ' ';
- for (p = items[2]; *p != NUL; mb_ptr_adv(p))
+ for (p = items[2]; *p != '\0'; mb_ptr_adv(p))
if (*p == '_')
*p = ' ';
add_fromto(spin, items[0][3] == 'S'
@@ -5129,7 +5129,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
int c;
// Check that every character appears only once.
- for (p = items[1]; *p != NUL; ) {
+ for (p = items[1]; *p != '\0'; ) {
c = mb_ptr2char_adv(&p);
if ((spin->si_map.ga_len > 0
&& vim_strchr(spin->si_map.ga_data, c)
@@ -5296,7 +5296,7 @@ static void aff_process_flags(afffile_T *affile, affentry_T *entry)
if (entry->ae_flags != NULL
&& (affile->af_compforbid != 0 || affile->af_comppermit != 0)) {
- for (p = entry->ae_flags; *p != NUL; ) {
+ for (p = entry->ae_flags; *p != '\0'; ) {
prevp = p;
flag = get_affitem(affile->af_flagtype, &p);
if (flag == affile->af_comppermit || flag == affile->af_compforbid) {
@@ -5310,7 +5310,7 @@ static void aff_process_flags(afffile_T *affile, affentry_T *entry)
if (affile->af_flagtype == AFT_NUM && *p == ',')
++p;
}
- if (*entry->ae_flags == NUL)
+ if (*entry->ae_flags == '\0')
entry->ae_flags = NULL; // nothing left
}
}
@@ -5342,7 +5342,7 @@ static unsigned affitem2flag(int flagtype, char_u *item, char_u *fname, int lnum
smsg((char_u *)_("Illegal flag in %s line %d: %s"),
fname, lnum, item);
}
- if (*p != NUL) {
+ if (*p != '\0') {
smsg((char_u *)_(e_affname), fname, lnum, item);
return 0;
}
@@ -5366,7 +5366,7 @@ static unsigned get_affitem(int flagtype, char_u **pp)
res = mb_ptr2char_adv(pp);
if (flagtype == AFT_LONG || (flagtype == AFT_CAPLONG
&& res >= 'A' && res <= 'Z')) {
- if (**pp == NUL)
+ if (**pp == '\0')
return 0;
res = mb_ptr2char_adv(pp) + (res << 16);
}
@@ -5406,7 +5406,7 @@ static void process_compflags(spellinfo_T *spin, afffile_T *aff, char_u *compfla
spin->si_compflags = p;
tp = p + STRLEN(p);
- for (p = compflags; *p != NUL; ) {
+ for (p = compflags; *p != '\0'; ) {
if (vim_strchr((char_u *)"/?*+[]", *p) != NULL)
// Copy non-flag characters directly.
*tp++ = *p++;
@@ -5443,7 +5443,7 @@ static void process_compflags(spellinfo_T *spin, afffile_T *aff, char_u *compfla
}
}
- *tp = NUL;
+ *tp = '\0';
}
// Check that the new IDs for postponed affixes and compounding don't overrun
@@ -5470,10 +5470,10 @@ static int flag_in_afflist(int flagtype, char_u *afflist, unsigned flag)
case AFT_CAPLONG:
case AFT_LONG:
- for (p = afflist; *p != NUL; ) {
+ for (p = afflist; *p != '\0'; ) {
n = mb_ptr2char_adv(&p);
if ((flagtype == AFT_LONG || (n >= 'A' && n <= 'Z'))
- && *p != NUL)
+ && *p != '\0')
n = mb_ptr2char_adv(&p) + (n << 16);
if (n == flag)
return TRUE;
@@ -5481,11 +5481,11 @@ static int flag_in_afflist(int flagtype, char_u *afflist, unsigned flag)
break;
case AFT_NUM:
- for (p = afflist; *p != NUL; ) {
+ for (p = afflist; *p != '\0'; ) {
n = getdigits(&p);
if (n == flag)
return TRUE;
- if (*p != NUL) // skip over comma
+ if (*p != '\0') // skip over comma
++p;
}
break;
@@ -5634,7 +5634,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
--l;
if (l == 0)
continue; // empty line
- line[l] = NUL;
+ line[l] = '\0';
// Convert from "SET" to 'encoding' when needed.
if (spin->si_conv.vc_type != CONV_NONE) {
@@ -5653,11 +5653,11 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
// Truncate the word at the "/", set "afflist" to what follows.
// Replace "\/" by "/" and "\\" by "\".
afflist = NULL;
- for (p = w; *p != NUL; mb_ptr_adv(p)) {
+ for (p = w; *p != '\0'; mb_ptr_adv(p)) {
if (*p == '\\' && (p[1] == '\\' || p[1] == '/'))
STRMOVE(p, p + 1);
else if (*p == '/') {
- *p = NUL;
+ *p = '\0';
afflist = p + 1;
break;
}
@@ -5706,7 +5706,7 @@ static int spell_read_dic(spellinfo_T *spin, char_u *fname, afffile_T *affile)
hash_add_item(&ht, hi, dw, hash);
flags = 0;
- store_afflist[0] = NUL;
+ store_afflist[0] = '\0';
pfxlen = 0;
need_affix = FALSE;
if (afflist != NULL) {
@@ -5801,7 +5801,7 @@ static int get_pfxlist(afffile_T *affile, char_u *afflist, char_u *store_afflist
char_u key[AH_KEY_LEN];
hashitem_T *hi;
- for (p = afflist; *p != NUL; ) {
+ for (p = afflist; *p != '\0'; ) {
prevp = p;
if (get_affitem(affile->af_flagtype, &p) != 0) {
// A flag is a postponed prefix flag if it appears in "af_pref"
@@ -5818,7 +5818,7 @@ static int get_pfxlist(afffile_T *affile, char_u *afflist, char_u *store_afflist
++p;
}
- store_afflist[cnt] = NUL;
+ store_afflist[cnt] = '\0';
return cnt;
}
@@ -5833,7 +5833,7 @@ static void get_compflags(afffile_T *affile, char_u *afflist, char_u *store_affl
char_u key[AH_KEY_LEN];
hashitem_T *hi;
- for (p = afflist; *p != NUL; ) {
+ for (p = afflist; *p != '\0'; ) {
prevp = p;
if (get_affitem(affile->af_flagtype, &p) != 0) {
// A flag is a compound flag if it appears in "af_comp".
@@ -5846,7 +5846,7 @@ static void get_compflags(afffile_T *affile, char_u *afflist, char_u *store_affl
++p;
}
- store_afflist[cnt] = NUL;
+ store_afflist[cnt] = '\0';
}
// Apply affixes to a word and store the resulting words.
@@ -5930,7 +5930,7 @@ store_aff_word (
if (xht == NULL) {
// prefix: chop/add at the start of the word
if (ae->ae_add == NULL)
- *newword = NUL;
+ *newword = '\0';
else
vim_strncpy(newword, ae->ae_add, MAXWLEN - 1);
p = word;
@@ -5953,7 +5953,7 @@ store_aff_word (
i = (int)MB_CHARLEN(ae->ae_chop);
for (; i > 0; --i)
mb_ptr_back(newword, p);
- *p = NUL;
+ *p = '\0';
}
if (ae->ae_add != NULL)
STRCAT(newword, ae->ae_add);
@@ -6012,14 +6012,14 @@ store_aff_word (
// Combine the list of compound flags.
// Concatenate them to the prefix IDs list.
// Avoid adding the same ID twice.
- for (i = pfxlen; pfxlist[i] != NUL; ++i) {
+ for (i = pfxlen; pfxlist[i] != '\0'; ++i) {
for (j = use_pfxlen;
- use_pfxlist[j] != NUL; ++j)
+ use_pfxlist[j] != '\0'; ++j)
if (pfxlist[i] == use_pfxlist[j])
break;
- if (use_pfxlist[j] == NUL) {
+ if (use_pfxlist[j] == '\0') {
use_pfxlist[j++] = pfxlist[i];
- use_pfxlist[j] = NUL;
+ use_pfxlist[j] = '\0';
}
}
}
@@ -6138,7 +6138,7 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
--l;
if (l == 0)
continue; // empty or blank line
- rline[l] = NUL;
+ rline[l] = '\0';
// Convert from "/encoding={encoding}" to 'encoding' when needed.
vim_free(pc);
@@ -6214,8 +6214,8 @@ static int spell_read_wordfile(spellinfo_T *spin, char_u *fname)
// Check for flags and region after a slash.
p = vim_strchr(line, '/');
if (p != NULL) {
- *p++ = NUL;
- while (*p != NUL) {
+ *p++ = '\0';
+ while (*p != '\0') {
if (*p == '=') // keep-case word
flags |= WF_KEEPCAP | WF_FIXCAP;
else if (*p == '!') // Bad, bad, wicked word.
@@ -6365,20 +6365,20 @@ store_word (
(void)spell_casefold(word, len, foldword, MAXWLEN);
for (p = pfxlist; res == OK; ++p) {
- if (!need_affix || (p != NULL && *p != NUL))
+ if (!need_affix || (p != NULL && *p != '\0'))
res = tree_add_word(spin, foldword, spin->si_foldroot, ct | flags,
region, p == NULL ? 0 : *p);
- if (p == NULL || *p == NUL)
+ if (p == NULL || *p == '\0')
break;
}
++spin->si_foldwcount;
if (res == OK && (ct == WF_KEEPCAP || (flags & WF_KEEPCAP))) {
for (p = pfxlist; res == OK; ++p) {
- if (!need_affix || (p != NULL && *p != NUL))
+ if (!need_affix || (p != NULL && *p != '\0'))
res = tree_add_word(spin, word, spin->si_keeproot, flags,
region, p == NULL ? 0 : *p);
- if (p == NULL || *p == NUL)
+ if (p == NULL || *p == '\0')
break;
}
++spin->si_keepwcount;
@@ -6415,7 +6415,7 @@ static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *root, int
if (np->wn_child != NULL)
++np->wn_child->wn_refs; // child gets extra ref
np->wn_byte = copyp->wn_byte;
- if (np->wn_byte == NUL) {
+ if (np->wn_byte == '\0') {
np->wn_flags = copyp->wn_flags;
np->wn_region = copyp->wn_region;
np->wn_affixID = copyp->wn_affixID;
@@ -6439,7 +6439,7 @@ static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *root, int
// done on flags and then on affixID.
while (node != NULL
&& (node->wn_byte < word[i]
- || (node->wn_byte == NUL
+ || (node->wn_byte == '\0'
&& (flags < 0
? node->wn_affixID < (unsigned)affixID
: (node->wn_flags < (unsigned)(flags & WN_MASK)
@@ -6453,7 +6453,7 @@ static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *root, int
}
if (node == NULL
|| node->wn_byte != word[i]
- || (word[i] == NUL
+ || (word[i] == '\0'
&& (flags < 0
|| spin->si_sugtree
|| node->wn_flags != (flags & WN_MASK)
@@ -6480,7 +6480,7 @@ static int tree_add_word(spellinfo_T *spin, char_u *word, wordnode_T *root, int
node = np;
}
- if (word[i] == NUL) {
+ if (word[i] == '\0') {
node->wn_flags = flags;
node->wn_region |= region;
node->wn_affixID = affixID;
@@ -6572,7 +6572,7 @@ int spell_check_msm(void)
if (!VIM_ISDIGIT(*p))
return FAIL;
added = getdigits(&p) * 1024;
- if (*p != NUL)
+ if (*p != '\0')
return FAIL;
if (start == 0 || incr == 0 || added == 0 || incr > start)
@@ -6741,7 +6741,7 @@ node_compress (
node->wn_u1.hashkey[0] = len;
nr = 0;
for (np = node; np != NULL; np = np->wn_sibling) {
- if (np->wn_byte == NUL)
+ if (np->wn_byte == '\0')
// end node: use wn_flags, wn_region and wn_affixID
n = np->wn_flags + (np->wn_region << 8) + (np->wn_affixID << 16);
else
@@ -6759,7 +6759,7 @@ node_compress (
node->wn_u1.hashkey[3] = n == 0 ? 1 : n;
n = (nr >> 24) & 0xff;
node->wn_u1.hashkey[4] = n == 0 ? 1 : n;
- node->wn_u1.hashkey[5] = NUL;
+ node->wn_u1.hashkey[5] = '\0';
// Check for CTRL-C pressed now and then.
fast_breakcheck();
@@ -6776,7 +6776,7 @@ static int node_equal(wordnode_T *n1, wordnode_T *n2)
for (p1 = n1, p2 = n2; p1 != NULL && p2 != NULL;
p1 = p1->wn_sibling, p2 = p2->wn_sibling)
if (p1->wn_byte != p2->wn_byte
- || (p1->wn_byte == NUL
+ || (p1->wn_byte == '\0'
? (p1->wn_flags != p2->wn_flags
|| p1->wn_region != p2->wn_region
|| p1->wn_affixID != p2->wn_affixID)
@@ -7181,7 +7181,7 @@ static void clear_node(wordnode_T *node)
np->wn_u1.index = 0;
np->wn_u2.wnode = NULL;
- if (np->wn_byte != NUL)
+ if (np->wn_byte != '\0')
clear_node(np->wn_child);
}
}
@@ -7448,7 +7448,7 @@ static int sug_filltree(spellinfo_T *spin, slang_T *slang)
c = byts[n];
if (c == 0) {
// Sound-fold the word.
- tword[depth] = NUL;
+ tword[depth] = '\0';
spell_soundfold(slang, tword, TRUE, tsalword);
// We use the "flags" field for the MSB of the wordnr,
@@ -7529,10 +7529,10 @@ sug_filltable (
int prev_nr;
for (p = node; p != NULL; p = p->wn_sibling) {
- if (p->wn_byte == NUL) {
+ if (p->wn_byte == '\0') {
gap->ga_len = 0;
prev_nr = 0;
- for (np = p; np != NULL && np->wn_byte == NUL; np = np->wn_sibling) {
+ for (np = p; np != NULL && np->wn_byte == '\0'; np = np->wn_sibling) {
ga_grow(gap, 10);
nr = (np->wn_flags << 16) + (np->wn_region & 0xffff);
@@ -7547,7 +7547,7 @@ sug_filltable (
}
// add the NUL byte
- ((char_u *)gap->ga_data)[gap->ga_len++] = NUL;
+ ((char_u *)gap->ga_data)[gap->ga_len++] = '\0';
if (ml_append_buf(spin->si_spellbuf, (linenr_T)wordnr,
gap->ga_data, gap->ga_len, TRUE) == FAIL)
@@ -7556,7 +7556,7 @@ sug_filltable (
// Remove extra NUL entries, we no longer need them. We don't
// bother freeing the nodes, the won't be reused anyway.
- while (p->wn_sibling != NULL && p->wn_sibling->wn_byte == NUL)
+ while (p->wn_sibling != NULL && p->wn_sibling->wn_byte == '\0')
p->wn_sibling = p->wn_sibling->wn_sibling;
// Clear the flags on the remaining NUL node, so that compression
@@ -8025,22 +8025,22 @@ spell_add_word (
fname = int_wordlist;
} else {
// If 'spellfile' isn't set figure out a good default value.
- if (*curwin->w_s->b_p_spf == NUL) {
+ if (*curwin->w_s->b_p_spf == '\0') {
init_spellfile();
new_spf = TRUE;
}
- if (*curwin->w_s->b_p_spf == NUL) {</