Skip to content

Commit

Permalink
compilecode: Split out cleanmarks() to separate file.
Browse files Browse the repository at this point in the history
cleanmarks() is used only by thompson/pike, so no need to pull it in for
other algorithms.
  • Loading branch information
pfalcon committed Jul 18, 2015
1 parent 7b10251 commit 9e7541f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 19 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ OFILES=\
compilecode.o\
dumpcode.o\
charclass.o\
cleanmarks.o\
util.o\
y.tab.o\

Expand Down
24 changes: 24 additions & 0 deletions cleanmarks.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// Copyright 2014 Paul Sokolovsky.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

#include "re1.5.h"

void
cleanmarks(ByteProg *prog)
{
char *pc = prog->insts;
char *end = pc + prog->bytelen;
while (pc < end) {
*pc &= 0x7f;
switch (*pc) {
case Jmp:
case Split:
case RSplit:
case Save:
case Char:
pc++;
}
pc++;
}
}
19 changes: 0 additions & 19 deletions compilecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -194,25 +194,6 @@ int re1_5_compilecode(ByteProg *prog, const char *re)
return 0;
}

void
cleanmarks(ByteProg *prog)
{
char *pc = prog->insts;
char *end = pc + prog->bytelen;
while (pc < end) {
*pc &= 0x7f;
switch (*pc) {
case Jmp:
case Split:
case RSplit:
case Save:
case Char:
pc++;
}
pc++;
}
}

#if 0
int main(int argc, char *argv[])
{
Expand Down

0 comments on commit 9e7541f

Please sign in to comment.