diff options
author | Yegappan Lakshmanan <yegappan@yahoo.com> | 2023-01-18 18:17:48 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-01-18 18:17:48 +0000 |
commit | f97a295ccaa9803367f3714cdefce4e2283c771d (patch) | |
tree | a5e4d3b6f9b6b5b8a123857d13aa3b423494c01f /src/regexp_bt.c | |
parent | 4aecaa168e90cf28da7a6facea6b11ae250a8a18 (diff) |
patch 9.0.1221: code is indented more than necessaryv9.0.1221
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11833)
Diffstat (limited to 'src/regexp_bt.c')
-rw-r--r-- | src/regexp_bt.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/regexp_bt.c b/src/regexp_bt.c index d2acbc2032..33af278bf6 100644 --- a/src/regexp_bt.c +++ b/src/regexp_bt.c @@ -3187,20 +3187,20 @@ save_subexpr(regbehind_T *bp) // When "rex.need_clear_subexpr" is set we don't need to save the values, // only remember that this flag needs to be set again when restoring. bp->save_need_clear_subexpr = rex.need_clear_subexpr; - if (!rex.need_clear_subexpr) + if (rex.need_clear_subexpr) + return; + + for (i = 0; i < NSUBEXP; ++i) { - for (i = 0; i < NSUBEXP; ++i) + if (REG_MULTI) { - if (REG_MULTI) - { - bp->save_start[i].se_u.pos = rex.reg_startpos[i]; - bp->save_end[i].se_u.pos = rex.reg_endpos[i]; - } - else - { - bp->save_start[i].se_u.ptr = rex.reg_startp[i]; - bp->save_end[i].se_u.ptr = rex.reg_endp[i]; - } + bp->save_start[i].se_u.pos = rex.reg_startpos[i]; + bp->save_end[i].se_u.pos = rex.reg_endpos[i]; + } + else + { + bp->save_start[i].se_u.ptr = rex.reg_startp[i]; + bp->save_end[i].se_u.ptr = rex.reg_endp[i]; } } } @@ -3215,20 +3215,20 @@ restore_subexpr(regbehind_T *bp) // Only need to restore saved values when they are not to be cleared. rex.need_clear_subexpr = bp->save_need_clear_subexpr; - if (!rex.need_clear_subexpr) + if (rex.need_clear_subexpr) + return; + + for (i = 0; i < NSUBEXP; ++i) { - for (i = 0; i < NSUBEXP; ++i) + if (REG_MULTI) { - if (REG_MULTI) - { - rex.reg_startpos[i] = bp->save_start[i].se_u.pos; - rex.reg_endpos[i] = bp->save_end[i].se_u.pos; - } - else - { - rex.reg_startp[i] = bp->save_start[i].se_u.ptr; - rex.reg_endp[i] = bp->save_end[i].se_u.ptr; - } + rex.reg_startpos[i] = bp->save_start[i].se_u.pos; + rex.reg_endpos[i] = bp->save_end[i].se_u.pos; + } + else + { + rex.reg_startp[i] = bp->save_start[i].se_u.ptr; + rex.reg_endp[i] = bp->save_end[i].se_u.ptr; } } } |