comparison src/syntax.c @ 29566:99e3763cbd34 v9.0.0124

patch 9.0.0124: code has more indent than needed Commit: https://github.com/vim/vim/commit/101d57b34b72f4fbc7df1b6edfd64c64a6be14fc Author: zeertzjq <zeertzjq@outlook.com> Date: Sun Jul 31 18:34:32 2022 +0100 patch 9.0.0124: code has more indent than needed Problem: Code has more indent than needed. Solution: Use continue and return statements. (closes https://github.com/vim/vim/issues/10824)
author Bram Moolenaar <Bram@vim.org>
date Sun, 31 Jul 2022 19:45:02 +0200
parents 48b36959a4fc
children 89e1d67814a9
comparison
equal deleted inserted replaced
29565:54893d648fd5 29566:99e3763cbd34
1483 int i, j; 1483 int i, j;
1484 bufstate_T *bp; 1484 bufstate_T *bp;
1485 reg_extmatch_T *six, *bsx; 1485 reg_extmatch_T *six, *bsx;
1486 1486
1487 // First a quick check if the stacks have the same size end nextlist. 1487 // First a quick check if the stacks have the same size end nextlist.
1488 if (sp->sst_stacksize == current_state.ga_len 1488 if (sp->sst_stacksize != current_state.ga_len
1489 && sp->sst_next_list == current_next_list) 1489 || sp->sst_next_list != current_next_list)
1490 { 1490 return FALSE;
1491 // Need to compare all states on both stacks. 1491
1492 if (sp->sst_stacksize > SST_FIX_STATES) 1492 // Need to compare all states on both stacks.
1493 bp = SYN_STATE_P(&(sp->sst_union.sst_ga)); 1493 if (sp->sst_stacksize > SST_FIX_STATES)
1494 else 1494 bp = SYN_STATE_P(&(sp->sst_union.sst_ga));
1495 bp = sp->sst_union.sst_stack; 1495 else
1496 1496 bp = sp->sst_union.sst_stack;
1497 for (i = current_state.ga_len; --i >= 0; ) 1497
1498 { 1498 for (i = current_state.ga_len; --i >= 0; )
1499 // If the item has another index the state is different. 1499 {
1500 if (bp[i].bs_idx != CUR_STATE(i).si_idx) 1500 // If the item has another index the state is different.
1501 break; 1501 if (bp[i].bs_idx != CUR_STATE(i).si_idx)
1502 if (bp[i].bs_extmatch != CUR_STATE(i).si_extmatch) 1502 break;
1503 { 1503 if (bp[i].bs_extmatch == CUR_STATE(i).si_extmatch)
1504 // When the extmatch pointers are different, the strings in 1504 continue;
1505 // them can still be the same. Check if the extmatch 1505 // When the extmatch pointers are different, the strings in them can
1506 // references are equal. 1506 // still be the same. Check if the extmatch references are equal.
1507 bsx = bp[i].bs_extmatch; 1507 bsx = bp[i].bs_extmatch;
1508 six = CUR_STATE(i).si_extmatch; 1508 six = CUR_STATE(i).si_extmatch;
1509 // If one of the extmatch pointers is NULL the states are 1509 // If one of the extmatch pointers is NULL the states are different.
1510 // different. 1510 if (bsx == NULL || six == NULL)
1511 if (bsx == NULL || six == NULL) 1511 break;
1512 for (j = 0; j < NSUBEXP; ++j)
1513 {
1514 // Check each referenced match string. They must all be equal.
1515 if (bsx->matches[j] != six->matches[j])
1516 {
1517 // If the pointer is different it can still be the same text.
1518 // Compare the strings, ignore case when the start item has the
1519 // sp_ic flag set.
1520 if (bsx->matches[j] == NULL || six->matches[j] == NULL)
1512 break; 1521 break;
1513 for (j = 0; j < NSUBEXP; ++j) 1522 if ((SYN_ITEMS(syn_block)[CUR_STATE(i).si_idx]).sp_ic
1514 { 1523 ? MB_STRICMP(bsx->matches[j], six->matches[j]) != 0
1515 // Check each referenced match string. They must all be 1524 : STRCMP(bsx->matches[j], six->matches[j]) != 0)
1516 // equal.
1517 if (bsx->matches[j] != six->matches[j])
1518 {
1519 // If the pointer is different it can still be the
1520 // same text. Compare the strings, ignore case when
1521 // the start item has the sp_ic flag set.
1522 if (bsx->matches[j] == NULL
1523 || six->matches[j] == NULL)
1524 break;
1525 if ((SYN_ITEMS(syn_block)[CUR_STATE(i).si_idx]).sp_ic
1526 ? MB_STRICMP(bsx->matches[j],
1527 six->matches[j]) != 0
1528 : STRCMP(bsx->matches[j], six->matches[j]) != 0)
1529 break;
1530 }
1531 }
1532 if (j != NSUBEXP)
1533 break; 1525 break;
1534 } 1526 }
1535 } 1527 }
1536 if (i < 0) 1528 if (j != NSUBEXP)
1537 return TRUE; 1529 break;
1538 } 1530 }
1539 return FALSE; 1531 return i < 0 ? TRUE : FALSE;
1540 } 1532 }
1541 1533
1542 /* 1534 /*
1543 * We stop parsing syntax above line "lnum". If the stored state at or below 1535 * We stop parsing syntax above line "lnum". If the stored state at or below
1544 * this line depended on a change before it, it now depends on the line below 1536 * this line depended on a change before it, it now depends on the line below