Skip to content

Commit a936474

Browse files
committed
lregex,refactor: narrow the scopes of local variables
Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 4fe51ed commit a936474

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

main/lregex.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1926,7 +1926,6 @@ static bool matchMultilineRegexPattern (struct lregexControlBlock *lcb,
19261926
{
19271927
const char *start;
19281928
const char *current;
1929-
off_t offset = 0;
19301929
regexPattern* patbuf = entry->pattern;
19311930
struct mGroupSpec *mgroup = &patbuf->mgroup;
19321931
struct guestSpec *guest = &patbuf->guest;
@@ -1958,9 +1957,6 @@ static bool matchMultilineRegexPattern (struct lregexControlBlock *lcb,
19581957
if (hasMessage(patbuf))
19591958
printMessage(lcb->owner, patbuf, (current + pmatch[0].rm_so) - start, current, pmatch);
19601959

1961-
offset = (current + pmatch [mgroup->forLineNumberDetermination].rm_so)
1962-
- start;
1963-
19641960
entry->statistics.match++;
19651961
scriptWindow window = {
19661962
.line = current,
@@ -1983,6 +1979,8 @@ static bool matchMultilineRegexPattern (struct lregexControlBlock *lcb,
19831979

19841980
if (patbuf->type == PTRN_TAG)
19851981
{
1982+
off_t offset = (current + pmatch [mgroup->forLineNumberDetermination].rm_so)
1983+
- start;
19861984
matchTagPattern (lcb, current, patbuf, pmatch, offset,
19871985
(patbuf->optscript && hasNameSlot (patbuf))? &window: NULL);
19881986
result = true;
@@ -2757,9 +2755,6 @@ static struct regexTable * matchMultitableRegexTable (struct lregexControlBlock
27572755
if (match == 0)
27582756
{
27592757
entry->statistics.match++;
2760-
off_t offset_for_tag = (current
2761-
+ pmatch [ptrn->mgroup.forLineNumberDetermination].rm_so)
2762-
- cstart;
27632758
scriptWindow window = {
27642759
.line = current,
27652760
.start = cstart,
@@ -2782,6 +2777,9 @@ static struct regexTable * matchMultitableRegexTable (struct lregexControlBlock
27822777

27832778
if (ptrn->type == PTRN_TAG)
27842779
{
2780+
off_t offset_for_tag = (current
2781+
+ pmatch [ptrn->mgroup.forLineNumberDetermination].rm_so)
2782+
- cstart;
27852783
matchTagPattern (lcb, current, ptrn, pmatch, offset_for_tag,
27862784
(ptrn->optscript && hasNameSlot (ptrn))? &window: NULL);
27872785

0 commit comments

Comments
 (0)