refactor: follow style guide

This commit is contained in:
dundargoc
2023-12-28 13:42:24 +01:00
committed by dundargoc
parent d634cd5b0b
commit c89292fcb7
90 changed files with 953 additions and 1121 deletions

View File

@@ -442,7 +442,7 @@ void spell_suggest(int count)
char wcopy[MAXWLEN + 2];
suginfo_T sug;
suggest_T *stp;
int mouse_used;
bool mouse_used;
int limit;
int selected = count;
int badlen = 0;
@@ -730,8 +730,8 @@ static void spell_find_suggest(char *badptr, int badlen, suginfo_T *su, int maxc
su->su_badlen = MAXWLEN - 1; // just in case
}
xstrlcpy(su->su_badword, su->su_badptr, (size_t)su->su_badlen + 1);
(void)spell_casefold(curwin, su->su_badptr, su->su_badlen, su->su_fbadword,
MAXWLEN);
spell_casefold(curwin, su->su_badptr, su->su_badlen, su->su_fbadword,
MAXWLEN);
// TODO(vim): make this work if the case-folded text is longer than the
// original text. Currently an illegal byte causes wrong pointer
@@ -845,7 +845,7 @@ static void spell_suggest_expr(suginfo_T *su, char *expr)
// Remove bogus suggestions, sort and truncate at "maxcount".
check_suggestions(su, &su->su_ga);
(void)cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
}
/// Find suggestions in file "fname". Used for "file:" in 'spellsuggest'.
@@ -892,7 +892,7 @@ static void spell_suggest_file(suginfo_T *su, char *fname)
// Remove bogus suggestions, sort and truncate at "maxcount".
check_suggestions(su, &su->su_ga);
(void)cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
}
/// Find suggestions for the internal method indicated by "sps_flags".
@@ -956,7 +956,7 @@ static void spell_suggest_intern(suginfo_T *su, bool interactive)
// got_int when using a command, not for spellsuggest().
os_breakcheck();
if (interactive && got_int) {
(void)vgetc();
vgetc();
got_int = false;
}
@@ -968,7 +968,7 @@ static void spell_suggest_intern(suginfo_T *su, bool interactive)
// Remove bogus suggestions, sort and truncate at "maxcount".
check_suggestions(su, &su->su_ga);
(void)cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
}
}
@@ -1064,7 +1064,7 @@ static void suggest_try_change(suginfo_T *su)
STRCPY(fword, su->su_fbadword);
int n = (int)strlen(fword);
char *p = su->su_badptr + su->su_badlen;
(void)spell_casefold(curwin, p, (int)strlen(p), fword + n, MAXWLEN - n);
spell_casefold(curwin, p, (int)strlen(p), fword + n, MAXWLEN - n);
// Make sure the resulting text is not longer than the original text.
n = (int)strlen(su->su_badptr);
@@ -1272,10 +1272,10 @@ static void suggest_trie_walk(suginfo_T *su, langp_T *lp, char *fword, bool soun
break;
}
int fword_ends = (fword[sp->ts_fidx] == NUL
|| (soundfold
? ascii_iswhite(fword[sp->ts_fidx])
: !spell_iswordp(fword + sp->ts_fidx, curwin)));
bool fword_ends = (fword[sp->ts_fidx] == NUL
|| (soundfold
? ascii_iswhite(fword[sp->ts_fidx])
: !spell_iswordp(fword + sp->ts_fidx, curwin)));
tword[sp->ts_twordlen] = NUL;
if (sp->ts_prefixdepth <= PFD_NOTSPECIAL
@@ -2538,8 +2538,8 @@ static void score_combine(suginfo_T *su)
}
if (slang == NULL) { // Using "double" without sound folding.
(void)cleanup_suggestions(&su->su_ga, su->su_maxscore,
su->su_maxcount);
cleanup_suggestions(&su->su_ga, su->su_maxscore,
su->su_maxcount);
return;
}
@@ -2558,9 +2558,9 @@ static void score_combine(suginfo_T *su)
// Remove bad suggestions, sort the suggestions and truncate at "maxcount"
// for both lists.
check_suggestions(su, &su->su_ga);
(void)cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
cleanup_suggestions(&su->su_ga, su->su_maxscore, su->su_maxcount);
check_suggestions(su, &su->su_sga);
(void)cleanup_suggestions(&su->su_sga, su->su_maxscore, su->su_maxcount);
cleanup_suggestions(&su->su_sga, su->su_maxscore, su->su_maxcount);
ga_init(&ga, (int)sizeof(suginfo_T), 1);
ga_grow(&ga, su->su_ga.ga_len + su->su_sga.ga_len);
@@ -2621,7 +2621,7 @@ static int stp_sal_score(suggest_T *stp, suginfo_T *su, slang_T *slang, char *ba
pbad = badsound;
} else {
// soundfold the bad word with more characters following
(void)spell_casefold(curwin, su->su_badptr, stp->st_orglen, fword, MAXWLEN);
spell_casefold(curwin, su->su_badptr, stp->st_orglen, fword, MAXWLEN);
// When joining two words the sound often changes a lot. E.g., "t he"
// sounds like "t h" while "the" sounds like "@". Avoid that by
@@ -3148,7 +3148,7 @@ static void check_suggestions(suginfo_T *su, garray_T *gap)
int len = stp[i].st_wordlen;
xstrlcpy(longword + len, su->su_badptr + stp[i].st_orglen, MAXWLEN + 1 - (size_t)len);
hlf_T attr = HLF_COUNT;
(void)spell_check(curwin, longword, &attr, NULL, false);
spell_check(curwin, longword, &attr, NULL, false);
if (attr != HLF_COUNT) {
// Remove this entry.
xfree(stp[i].st_word);