mirror of
https://github.com/neovim/neovim.git
synced 2025-09-24 03:58:32 +00:00
Replace ga->ga_len > 0 checks with !GA_EMPTY(ga)
Used Coccinelle to perform the changes ```diff @@ expression E; @@ <... ( - E.ga_len > 0 + !GA_EMPTY(&E) | - E->ga_len > 0 + !GA_EMPTY(E) ) ...> ``` `spatch --in-place --sp-file ga_empty.cocci <C_FILE>`
This commit is contained in:

committed by
Thiago de Arruda

parent
659cd0e99a
commit
b4efff6523
@@ -10766,7 +10766,7 @@ static garray_T ga_userinput = {0, 0, sizeof(tasave_T), 4, NULL};
|
|||||||
*/
|
*/
|
||||||
static void f_inputrestore(typval_T *argvars, typval_T *rettv)
|
static void f_inputrestore(typval_T *argvars, typval_T *rettv)
|
||||||
{
|
{
|
||||||
if (ga_userinput.ga_len > 0) {
|
if (!GA_EMPTY(&ga_userinput)) {
|
||||||
--ga_userinput.ga_len;
|
--ga_userinput.ga_len;
|
||||||
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
|
restore_typeahead((tasave_T *)(ga_userinput.ga_data)
|
||||||
+ ga_userinput.ga_len);
|
+ ga_userinput.ga_len);
|
||||||
|
@@ -580,7 +580,7 @@ void ex_breakdel(exarg_T *eap)
|
|||||||
if (todel < 0)
|
if (todel < 0)
|
||||||
EMSG2(_("E161: Breakpoint not found: %s"), eap->arg);
|
EMSG2(_("E161: Breakpoint not found: %s"), eap->arg);
|
||||||
else {
|
else {
|
||||||
while (gap->ga_len > 0) {
|
while (!GA_EMPTY(gap)) {
|
||||||
free(DEBUGGY(gap, todel).dbg_name);
|
free(DEBUGGY(gap, todel).dbg_name);
|
||||||
vim_regfree(DEBUGGY(gap, todel).dbg_prog);
|
vim_regfree(DEBUGGY(gap, todel).dbg_prog);
|
||||||
--gap->ga_len;
|
--gap->ga_len;
|
||||||
|
@@ -872,7 +872,7 @@ int flags;
|
|||||||
* When not inside any ":while" loop, clear remembered lines.
|
* When not inside any ":while" loop, clear remembered lines.
|
||||||
*/
|
*/
|
||||||
if (cstack.cs_looplevel == 0) {
|
if (cstack.cs_looplevel == 0) {
|
||||||
if (lines_ga.ga_len > 0) {
|
if (!GA_EMPTY(&lines_ga)) {
|
||||||
sourcing_lnum =
|
sourcing_lnum =
|
||||||
((wcmd_T *)lines_ga.ga_data)[lines_ga.ga_len - 1].lnum;
|
((wcmd_T *)lines_ga.ga_data)[lines_ga.ga_len - 1].lnum;
|
||||||
free_cmdlines(&lines_ga);
|
free_cmdlines(&lines_ga);
|
||||||
@@ -1188,7 +1188,7 @@ static void store_loop_line(garray_T *gap, char_u *line)
|
|||||||
*/
|
*/
|
||||||
static void free_cmdlines(garray_T *gap)
|
static void free_cmdlines(garray_T *gap)
|
||||||
{
|
{
|
||||||
while (gap->ga_len > 0) {
|
while (!GA_EMPTY(gap)) {
|
||||||
free(((wcmd_T *)(gap->ga_data))[gap->ga_len - 1].line);
|
free(((wcmd_T *)(gap->ga_data))[gap->ga_len - 1].line);
|
||||||
--gap->ga_len;
|
--gap->ga_len;
|
||||||
}
|
}
|
||||||
|
@@ -1831,7 +1831,7 @@ getexmodeline (
|
|||||||
|
|
||||||
if (c1 == BS || c1 == K_BS
|
if (c1 == BS || c1 == K_BS
|
||||||
|| c1 == DEL || c1 == K_DEL || c1 == K_KDEL) {
|
|| c1 == DEL || c1 == K_DEL || c1 == K_KDEL) {
|
||||||
if (line_ga.ga_len > 0) {
|
if (!GA_EMPTY(&line_ga)) {
|
||||||
--line_ga.ga_len;
|
--line_ga.ga_len;
|
||||||
goto redraw;
|
goto redraw;
|
||||||
}
|
}
|
||||||
@@ -1940,7 +1940,7 @@ redraw:
|
|||||||
|
|
||||||
/* We are done when a NL is entered, but not when it comes after an
|
/* We are done when a NL is entered, but not when it comes after an
|
||||||
* odd number of backslashes, that results in a NUL. */
|
* odd number of backslashes, that results in a NUL. */
|
||||||
if (line_ga.ga_len > 0 && pend[-1] == '\n') {
|
if (!GA_EMPTY(&line_ga) && pend[-1] == '\n') {
|
||||||
int bcount = 0;
|
int bcount = 0;
|
||||||
|
|
||||||
while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
|
while (line_ga.ga_len - 2 >= bcount && pend[-2 - bcount] == '\\')
|
||||||
|
@@ -138,7 +138,7 @@ int hasAnyFolding(win_T *win)
|
|||||||
{
|
{
|
||||||
/* very simple now, but can become more complex later */
|
/* very simple now, but can become more complex later */
|
||||||
return win->w_p_fen
|
return win->w_p_fen
|
||||||
&& (!foldmethodIsManual(win) || win->w_folds.ga_len > 0);
|
&& (!foldmethodIsManual(win) || !GA_EMPTY(&win->w_folds));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* hasFolding() {{{2 */
|
/* hasFolding() {{{2 */
|
||||||
@@ -2655,7 +2655,7 @@ static void foldMerge(fold_T *fp1, garray_T *gap, fold_T *fp2)
|
|||||||
foldMerge(fp3, gap2, fp4);
|
foldMerge(fp3, gap2, fp4);
|
||||||
|
|
||||||
/* Move nested folds in fp2 to the end of fp1. */
|
/* Move nested folds in fp2 to the end of fp1. */
|
||||||
if (gap2->ga_len > 0) {
|
if (!GA_EMPTY(gap2)) {
|
||||||
ga_grow(gap1, gap2->ga_len);
|
ga_grow(gap1, gap2->ga_len);
|
||||||
for (idx = 0; idx < gap2->ga_len; ++idx) {
|
for (idx = 0; idx < gap2->ga_len; ++idx) {
|
||||||
((fold_T *)gap1->ga_data)[gap1->ga_len]
|
((fold_T *)gap1->ga_data)[gap1->ga_len]
|
||||||
@@ -2982,7 +2982,7 @@ static int put_foldopen_recurse(FILE *fd, win_T *wp, garray_T *gap, linenr_T off
|
|||||||
fp = (fold_T *)gap->ga_data;
|
fp = (fold_T *)gap->ga_data;
|
||||||
for (i = 0; i < gap->ga_len; i++) {
|
for (i = 0; i < gap->ga_len; i++) {
|
||||||
if (fp->fd_flags != FD_LEVEL) {
|
if (fp->fd_flags != FD_LEVEL) {
|
||||||
if (fp->fd_nested.ga_len > 0) {
|
if (!GA_EMPTY(&fp->fd_nested)) {
|
||||||
/* open nested folds while this fold is open */
|
/* open nested folds while this fold is open */
|
||||||
if (fprintf(fd, "%" PRId64, (int64_t)(fp->fd_top + off)) < 0
|
if (fprintf(fd, "%" PRId64, (int64_t)(fp->fd_top + off)) < 0
|
||||||
|| put_eol(fd) == FAIL
|
|| put_eol(fd) == FAIL
|
||||||
|
@@ -185,7 +185,7 @@ void ga_append(garray_T *gap, char c)
|
|||||||
void append_ga_line(garray_T *gap)
|
void append_ga_line(garray_T *gap)
|
||||||
{
|
{
|
||||||
// Remove trailing CR.
|
// Remove trailing CR.
|
||||||
if ((gap->ga_len > 0)
|
if (!GA_EMPTY(gap)
|
||||||
&& !curbuf->b_p_bin
|
&& !curbuf->b_p_bin
|
||||||
&& (((char_u *)gap->ga_data)[gap->ga_len - 1] == CAR)) {
|
&& (((char_u *)gap->ga_data)[gap->ga_len - 1] == CAR)) {
|
||||||
gap->ga_len--;
|
gap->ga_len--;
|
||||||
|
@@ -16,6 +16,8 @@ typedef struct growarray {
|
|||||||
|
|
||||||
#define GA_EMPTY_INIT_VALUE { 0, 0, 0, 0, NULL }
|
#define GA_EMPTY_INIT_VALUE { 0, 0, 0, 0, NULL }
|
||||||
|
|
||||||
|
#define GA_EMPTY(ga_ptr) ((ga_ptr)->ga_len <= 0)
|
||||||
|
|
||||||
void ga_clear(garray_T *gap);
|
void ga_clear(garray_T *gap);
|
||||||
void ga_clear_strings(garray_T *gap);
|
void ga_clear_strings(garray_T *gap);
|
||||||
void ga_init(garray_T *gap, int itemsize, int growsize);
|
void ga_init(garray_T *gap, int itemsize, int growsize);
|
||||||
|
@@ -1513,7 +1513,7 @@ static void prt_def_var(char *name, double value, int prec)
|
|||||||
|
|
||||||
static void prt_flush_buffer(void)
|
static void prt_flush_buffer(void)
|
||||||
{
|
{
|
||||||
if (prt_ps_buffer.ga_len > 0) {
|
if (!GA_EMPTY(&prt_ps_buffer)) {
|
||||||
/* Any background color must be drawn first */
|
/* Any background color must be drawn first */
|
||||||
if (prt_do_bgcol && (prt_new_bgcol != PRCOLOR_WHITE)) {
|
if (prt_do_bgcol && (prt_new_bgcol != PRCOLOR_WHITE)) {
|
||||||
int r, g, b;
|
int r, g, b;
|
||||||
|
@@ -1964,7 +1964,7 @@ void set_init_1(void)
|
|||||||
/* First time count the NUL, otherwise count the ','. */
|
/* First time count the NUL, otherwise count the ','. */
|
||||||
len = (int)STRLEN(p) + 3;
|
len = (int)STRLEN(p) + 3;
|
||||||
ga_grow(&ga, len);
|
ga_grow(&ga, len);
|
||||||
if (ga.ga_len > 0)
|
if (!GA_EMPTY(&ga))
|
||||||
STRCAT(ga.ga_data, ",");
|
STRCAT(ga.ga_data, ",");
|
||||||
STRCAT(ga.ga_data, p);
|
STRCAT(ga.ga_data, p);
|
||||||
add_pathsep(ga.ga_data);
|
add_pathsep(ga.ga_data);
|
||||||
|
@@ -229,7 +229,7 @@ int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (opts & kShellOptRead) {
|
if (opts & kShellOptRead) {
|
||||||
if (pdata.ga.ga_len > 0) {
|
if (!GA_EMPTY(&pdata.ga)) {
|
||||||
// If there's an unfinished line in the growable array, append it now.
|
// If there's an unfinished line in the growable array, append it now.
|
||||||
append_ga_line(&pdata.ga);
|
append_ga_line(&pdata.ga);
|
||||||
// remember that the NL was missing
|
// remember that the NL was missing
|
||||||
|
@@ -1094,7 +1094,7 @@ gen_expand_wildcards (
|
|||||||
free(t);
|
free(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (did_expand_in_path && ga.ga_len > 0 && (flags & EW_PATH))
|
if (did_expand_in_path && !GA_EMPTY(&ga) && (flags & EW_PATH))
|
||||||
uniquefy_paths(&ga, p);
|
uniquefy_paths(&ga, p);
|
||||||
if (p != pat[i])
|
if (p != pat[i])
|
||||||
free(p);
|
free(p);
|
||||||
|
@@ -4697,7 +4697,7 @@ regmatch (
|
|||||||
* If there is something on the regstack execute the code for the state.
|
* If there is something on the regstack execute the code for the state.
|
||||||
* If the state is popped then loop and use the older state.
|
* If the state is popped then loop and use the older state.
|
||||||
*/
|
*/
|
||||||
while (regstack.ga_len > 0 && status != RA_FAIL) {
|
while (!GA_EMPTY(®stack) && status != RA_FAIL) {
|
||||||
rp = (regitem_T *)((char *)regstack.ga_data + regstack.ga_len) - 1;
|
rp = (regitem_T *)((char *)regstack.ga_data + regstack.ga_len) - 1;
|
||||||
switch (rp->rs_state) {
|
switch (rp->rs_state) {
|
||||||
case RS_NOPEN:
|
case RS_NOPEN:
|
||||||
|
@@ -2380,7 +2380,7 @@ win_line (
|
|||||||
|
|
||||||
if (wp->w_p_spell
|
if (wp->w_p_spell
|
||||||
&& *wp->w_s->b_p_spl != NUL
|
&& *wp->w_s->b_p_spl != NUL
|
||||||
&& wp->w_s->b_langp.ga_len > 0
|
&& !GA_EMPTY(&wp->w_s->b_langp)
|
||||||
&& *(char **)(wp->w_s->b_langp.ga_data) != NULL) {
|
&& *(char **)(wp->w_s->b_langp.ga_data) != NULL) {
|
||||||
/* Prepare for spell checking. */
|
/* Prepare for spell checking. */
|
||||||
has_spell = TRUE;
|
has_spell = TRUE;
|
||||||
|
@@ -2324,7 +2324,7 @@ static void slang_clear(slang_T *lp)
|
|||||||
|
|
||||||
for (round = 1; round <= 2; ++round) {
|
for (round = 1; round <= 2; ++round) {
|
||||||
gap = round == 1 ? &lp->sl_rep : &lp->sl_repsal;
|
gap = round == 1 ? &lp->sl_rep : &lp->sl_repsal;
|
||||||
while (gap->ga_len > 0) {
|
while (!GA_EMPTY(gap)) {
|
||||||
ftp = &((fromto_T *)gap->ga_data)[--gap->ga_len];
|
ftp = &((fromto_T *)gap->ga_data)[--gap->ga_len];
|
||||||
free(ftp->ft_from);
|
free(ftp->ft_from);
|
||||||
free(ftp->ft_to);
|
free(ftp->ft_to);
|
||||||
@@ -2341,7 +2341,7 @@ static void slang_clear(slang_T *lp)
|
|||||||
free(((int **)gap->ga_data)[i]);
|
free(((int **)gap->ga_data)[i]);
|
||||||
} else
|
} else
|
||||||
// SAL items: free salitem_T items
|
// SAL items: free salitem_T items
|
||||||
while (gap->ga_len > 0) {
|
while (!GA_EMPTY(gap)) {
|
||||||
smp = &((salitem_T *)gap->ga_data)[--gap->ga_len];
|
smp = &((salitem_T *)gap->ga_data)[--gap->ga_len];
|
||||||
free(smp->sm_lead);
|
free(smp->sm_lead);
|
||||||
// Don't free sm_oneof and sm_rules, they point into sm_lead.
|
// Don't free sm_oneof and sm_rules, they point into sm_lead.
|
||||||
@@ -2915,7 +2915,7 @@ static int read_sal_section(FILE *fd, slang_T *slang)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gap->ga_len > 0) {
|
if (!GA_EMPTY(gap)) {
|
||||||
// Add one extra entry to mark the end with an empty sm_lead. Avoids
|
// Add one extra entry to mark the end with an empty sm_lead. Avoids
|
||||||
// that we need to check the index every time.
|
// that we need to check the index every time.
|
||||||
smp = &((salitem_T *)gap->ga_data)[gap->ga_len];
|
smp = &((salitem_T *)gap->ga_data)[gap->ga_len];
|
||||||
@@ -3865,14 +3865,14 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
lp = LANGP_ENTRY(ga, i);
|
lp = LANGP_ENTRY(ga, i);
|
||||||
|
|
||||||
// sound folding
|
// sound folding
|
||||||
if (lp->lp_slang->sl_sal.ga_len > 0)
|
if (!GA_EMPTY(&lp->lp_slang->sl_sal))
|
||||||
// language does sound folding itself
|
// language does sound folding itself
|
||||||
lp->lp_sallang = lp->lp_slang;
|
lp->lp_sallang = lp->lp_slang;
|
||||||
else
|
else
|
||||||
// find first similar language that does sound folding
|
// find first similar language that does sound folding
|
||||||
for (j = 0; j < ga.ga_len; ++j) {
|
for (j = 0; j < ga.ga_len; ++j) {
|
||||||
lp2 = LANGP_ENTRY(ga, j);
|
lp2 = LANGP_ENTRY(ga, j);
|
||||||
if (lp2->lp_slang->sl_sal.ga_len > 0
|
if (!GA_EMPTY(&lp2->lp_slang->sl_sal)
|
||||||
&& STRNCMP(lp->lp_slang->sl_name,
|
&& STRNCMP(lp->lp_slang->sl_name,
|
||||||
lp2->lp_slang->sl_name, 2) == 0) {
|
lp2->lp_slang->sl_name, 2) == 0) {
|
||||||
lp->lp_sallang = lp2->lp_slang;
|
lp->lp_sallang = lp2->lp_slang;
|
||||||
@@ -3881,14 +3881,14 @@ char_u *did_set_spelllang(win_T *wp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// REP items
|
// REP items
|
||||||
if (lp->lp_slang->sl_rep.ga_len > 0)
|
if (!GA_EMPTY(&lp->lp_slang->sl_rep))
|
||||||
// language has REP items itself
|
// language has REP items itself
|
||||||
lp->lp_replang = lp->lp_slang;
|
lp->lp_replang = lp->lp_slang;
|
||||||
else
|
else
|
||||||
// find first similar language that has REP items
|
// find first similar language that has REP items
|
||||||
for (j = 0; j < ga.ga_len; ++j) {
|
for (j = 0; j < ga.ga_len; ++j) {
|
||||||
lp2 = LANGP_ENTRY(ga, j);
|
lp2 = LANGP_ENTRY(ga, j);
|
||||||
if (lp2->lp_slang->sl_rep.ga_len > 0
|
if (!GA_EMPTY(&lp2->lp_slang->sl_rep)
|
||||||
&& STRNCMP(lp->lp_slang->sl_name,
|
&& STRNCMP(lp->lp_slang->sl_name,
|
||||||
lp2->lp_slang->sl_name, 2) == 0) {
|
lp2->lp_slang->sl_name, 2) == 0) {
|
||||||
lp->lp_replang = lp2->lp_slang;
|
lp->lp_replang = lp2->lp_slang;
|
||||||
@@ -5131,7 +5131,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
|
|||||||
// Check that every character appears only once.
|
// Check that every character appears only once.
|
||||||
for (p = items[1]; *p != NUL; ) {
|
for (p = items[1]; *p != NUL; ) {
|
||||||
c = mb_ptr2char_adv(&p);
|
c = mb_ptr2char_adv(&p);
|
||||||
if ((spin->si_map.ga_len > 0
|
if ((!GA_EMPTY(&spin->si_map)
|
||||||
&& vim_strchr(spin->si_map.ga_data, c)
|
&& vim_strchr(spin->si_map.ga_data, c)
|
||||||
!= NULL)
|
!= NULL)
|
||||||
|| vim_strchr(p, c) != NULL)
|
|| vim_strchr(p, c) != NULL)
|
||||||
@@ -5257,7 +5257,7 @@ static afffile_T *spell_read_aff(spellinfo_T *spin, char_u *fname)
|
|||||||
if (sofofrom == NULL || sofoto == NULL)
|
if (sofofrom == NULL || sofoto == NULL)
|
||||||
smsg((char_u *)_("Missing SOFO%s line in %s"),
|
smsg((char_u *)_("Missing SOFO%s line in %s"),
|
||||||
sofofrom == NULL ? "FROM" : "TO", fname);
|
sofofrom == NULL ? "FROM" : "TO", fname);
|
||||||
else if (spin->si_sal.ga_len > 0)
|
else if (!GA_EMPTY(&spin->si_sal))
|
||||||
smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname);
|
smsg((char_u *)_("Both SAL and SOFO lines in %s"), fname);
|
||||||
else {
|
else {
|
||||||
aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM");
|
aff_check_string(spin->si_sofofr, sofofrom, "SOFOFROM");
|
||||||
@@ -6909,7 +6909,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// SN_PREFCOND: <prefcondcnt> <prefcond> ...
|
// SN_PREFCOND: <prefcondcnt> <prefcond> ...
|
||||||
if (spin->si_prefcond.ga_len > 0) {
|
if (!GA_EMPTY(&spin->si_prefcond)) {
|
||||||
putc(SN_PREFCOND, fd); // <sectionID>
|
putc(SN_PREFCOND, fd); // <sectionID>
|
||||||
putc(SNF_REQUIRED, fd); // <sectionflags>
|
putc(SNF_REQUIRED, fd); // <sectionflags>
|
||||||
|
|
||||||
@@ -7037,7 +7037,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
|
|||||||
|
|
||||||
// SN_MAP: <mapstr>
|
// SN_MAP: <mapstr>
|
||||||
// This is for making suggestions, section is not required.
|
// This is for making suggestions, section is not required.
|
||||||
if (spin->si_map.ga_len > 0) {
|
if (!GA_EMPTY(&spin->si_map)) {
|
||||||
putc(SN_MAP, fd); // <sectionID>
|
putc(SN_MAP, fd); // <sectionID>
|
||||||
putc(0, fd); // <sectionflags>
|
putc(0, fd); // <sectionflags>
|
||||||
l = spin->si_map.ga_len;
|
l = spin->si_map.ga_len;
|
||||||
@@ -7052,7 +7052,7 @@ static int write_vim_spell(spellinfo_T *spin, char_u *fname)
|
|||||||
// with this .spl file. That's because the word numbers must be exactly
|
// with this .spl file. That's because the word numbers must be exactly
|
||||||
// right.
|
// right.
|
||||||
if (!spin->si_nosugfile
|
if (!spin->si_nosugfile
|
||||||
&& (spin->si_sal.ga_len > 0
|
&& (!GA_EMPTY(&spin->si_sal)
|
||||||
|| (spin->si_sofofr != NULL && spin->si_sofoto != NULL))) {
|
|| (spin->si_sofofr != NULL && spin->si_sofoto != NULL))) {
|
||||||
putc(SN_SUGFILE, fd); // <sectionID>
|
putc(SN_SUGFILE, fd); // <sectionID>
|
||||||
putc(0, fd); // <sectionflags>
|
putc(0, fd); // <sectionflags>
|
||||||
@@ -8151,7 +8151,7 @@ static void init_spellfile(void)
|
|||||||
int aspath = FALSE;
|
int aspath = FALSE;
|
||||||
char_u *lstart = curbuf->b_s.b_p_spl;
|
char_u *lstart = curbuf->b_s.b_p_spl;
|
||||||
|
|
||||||
if (*curwin->w_s->b_p_spl != NUL && curwin->w_s->b_langp.ga_len > 0) {
|
if (*curwin->w_s->b_p_spl != NUL && !GA_EMPTY(&curwin->w_s->b_langp)) {
|
||||||
buf = alloc(MAXPATHL);
|
buf = alloc(MAXPATHL);
|
||||||
|
|
||||||
// Find the end of the language name. Exclude the region. If there
|
// Find the end of the language name. Exclude the region. If there
|
||||||
@@ -11011,7 +11011,7 @@ static void score_comp_sal(suginfo_T *su)
|
|||||||
// Use the sound-folding of the first language that supports it.
|
// Use the sound-folding of the first language that supports it.
|
||||||
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
if (lp->lp_slang->sl_sal.ga_len > 0) {
|
if (!GA_EMPTY(&lp->lp_slang->sl_sal)) {
|
||||||
// soundfold the bad word
|
// soundfold the bad word
|
||||||
spell_soundfold(lp->lp_slang, su->su_fbadword, TRUE, badsound);
|
spell_soundfold(lp->lp_slang, su->su_fbadword, TRUE, badsound);
|
||||||
|
|
||||||
@@ -11058,7 +11058,7 @@ static void score_combine(suginfo_T *su)
|
|||||||
// Add the alternate score to su_ga.
|
// Add the alternate score to su_ga.
|
||||||
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
if (lp->lp_slang->sl_sal.ga_len > 0) {
|
if (!GA_EMPTY(&lp->lp_slang->sl_sal)) {
|
||||||
// soundfold the bad word
|
// soundfold the bad word
|
||||||
slang = lp->lp_slang;
|
slang = lp->lp_slang;
|
||||||
spell_soundfold(slang, su->su_fbadword, TRUE, badsound);
|
spell_soundfold(slang, su->su_fbadword, TRUE, badsound);
|
||||||
@@ -11216,7 +11216,7 @@ static void suggest_try_soundalike_prep(void)
|
|||||||
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
slang = lp->lp_slang;
|
slang = lp->lp_slang;
|
||||||
if (slang->sl_sal.ga_len > 0 && slang->sl_sbyts != NULL)
|
if (!GA_EMPTY(&slang->sl_sal) && slang->sl_sbyts != NULL)
|
||||||
// prepare the hashtable used by add_sound_suggest()
|
// prepare the hashtable used by add_sound_suggest()
|
||||||
hash_init(&slang->sl_sounddone);
|
hash_init(&slang->sl_sounddone);
|
||||||
}
|
}
|
||||||
@@ -11236,7 +11236,7 @@ static void suggest_try_soundalike(suginfo_T *su)
|
|||||||
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
slang = lp->lp_slang;
|
slang = lp->lp_slang;
|
||||||
if (slang->sl_sal.ga_len > 0 && slang->sl_sbyts != NULL) {
|
if (!GA_EMPTY(&slang->sl_sal) && slang->sl_sbyts != NULL) {
|
||||||
// soundfold the bad word
|
// soundfold the bad word
|
||||||
spell_soundfold(slang, su->su_fbadword, TRUE, salword);
|
spell_soundfold(slang, su->su_fbadword, TRUE, salword);
|
||||||
|
|
||||||
@@ -11262,7 +11262,7 @@ static void suggest_try_soundalike_finish(void)
|
|||||||
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
slang = lp->lp_slang;
|
slang = lp->lp_slang;
|
||||||
if (slang->sl_sal.ga_len > 0 && slang->sl_sbyts != NULL) {
|
if (!GA_EMPTY(&slang->sl_sal) && slang->sl_sbyts != NULL) {
|
||||||
// Free the info about handled words.
|
// Free the info about handled words.
|
||||||
todo = (int)slang->sl_sounddone.ht_used;
|
todo = (int)slang->sl_sounddone.ht_used;
|
||||||
for (hi = slang->sl_sounddone.ht_array; todo > 0; ++hi)
|
for (hi = slang->sl_sounddone.ht_array; todo > 0; ++hi)
|
||||||
@@ -11825,7 +11825,7 @@ static void rescore_one(suginfo_T *su, suggest_T *stp)
|
|||||||
|
|
||||||
// Only rescore suggestions that have no sal score yet and do have a
|
// Only rescore suggestions that have no sal score yet and do have a
|
||||||
// language.
|
// language.
|
||||||
if (slang != NULL && slang->sl_sal.ga_len > 0 && !stp->st_had_bonus) {
|
if (slang != NULL && !GA_EMPTY(&slang->sl_sal) && !stp->st_had_bonus) {
|
||||||
if (slang == su->su_sallang)
|
if (slang == su->su_sallang)
|
||||||
p = su->su_sal_badword;
|
p = su->su_sal_badword;
|
||||||
else {
|
else {
|
||||||
@@ -11899,7 +11899,7 @@ char_u *eval_soundfold(char_u *word)
|
|||||||
// Use the sound-folding of the first language that supports it.
|
// Use the sound-folding of the first language that supports it.
|
||||||
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
for (lpi = 0; lpi < curwin->w_s->b_langp.ga_len; ++lpi) {
|
||||||
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
lp = LANGP_ENTRY(curwin->w_s->b_langp, lpi);
|
||||||
if (lp->lp_slang->sl_sal.ga_len > 0) {
|
if (!GA_EMPTY(&lp->lp_slang->sl_sal)) {
|
||||||
// soundfold the word
|
// soundfold the word
|
||||||
spell_soundfold(lp->lp_slang, word, FALSE, sound);
|
spell_soundfold(lp->lp_slang, word, FALSE, sound);
|
||||||
return vim_strsave(sound);
|
return vim_strsave(sound);
|
||||||
|
@@ -951,7 +951,7 @@ static void syn_start_line(void)
|
|||||||
* Need to update the end of a start/skip/end that continues from the
|
* Need to update the end of a start/skip/end that continues from the
|
||||||
* previous line and regions that have "keepend".
|
* previous line and regions that have "keepend".
|
||||||
*/
|
*/
|
||||||
if (current_state.ga_len > 0) {
|
if (!GA_EMPTY(¤t_state)) {
|
||||||
syn_update_ends(TRUE);
|
syn_update_ends(TRUE);
|
||||||
check_state_ends();
|
check_state_ends();
|
||||||
}
|
}
|
||||||
@@ -2187,7 +2187,7 @@ syn_current_attr (
|
|||||||
*/
|
*/
|
||||||
if (!syncing && !keep_state) {
|
if (!syncing && !keep_state) {
|
||||||
check_state_ends();
|
check_state_ends();
|
||||||
if (current_state.ga_len > 0
|
if (!GA_EMPTY(¤t_state)
|
||||||
&& syn_getcurline()[current_col] != NUL) {
|
&& syn_getcurline()[current_col] != NUL) {
|
||||||
++current_col;
|
++current_col;
|
||||||
check_state_ends();
|
check_state_ends();
|
||||||
@@ -2207,7 +2207,7 @@ syn_current_attr (
|
|||||||
&& !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY)))
|
&& !(current_next_flags & (HL_SKIPNL | HL_SKIPEMPTY)))
|
||||||
current_next_list = NULL;
|
current_next_list = NULL;
|
||||||
|
|
||||||
if (zero_width_next_ga.ga_len > 0)
|
if (!GA_EMPTY(&zero_width_next_ga))
|
||||||
ga_clear(&zero_width_next_ga);
|
ga_clear(&zero_width_next_ga);
|
||||||
|
|
||||||
/* No longer need external matches. But keep next_match_extmatch. */
|
/* No longer need external matches. But keep next_match_extmatch. */
|
||||||
|
Reference in New Issue
Block a user