Skip to content

Commit

Permalink
a couple of minor fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
DmitryOlshansky committed May 31, 2011
1 parent 9afb00e commit c7be162
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
4 changes: 2 additions & 2 deletions changelog.dd
Expand Up @@ -23,7 +23,7 @@ $(VERSION 053, ddd mm, 2011, =================================================,
$(LI $(BUGZILLA 5451): Three ideas for RedBlackTree)
$(LI $(BUGZILLA 5474): unaryFun byRef is borked for custom parameter name)
$(LI $(BUGZILLA 5485): TLS sections handled incorrectly in FreeBSD)
$(LI $(BUGZILLA 5511): std.regex optional capture with no-match cause error
$(LI $(BUGZILLA 5511): std.regex optional capture with no-match cause error)
$(LI $(BUGZILLA 5616): std.datetime: not cross-platform)
$(LI $(BUGZILLA 5654): BigInt returns ZERO with strings of single digit number with leading zeros)
$(LI $(BUGZILLA 5661): std.algorithm.move does not work on elaborate struct)
Expand All @@ -33,7 +33,7 @@ $(VERSION 053, ddd mm, 2011, =================================================,
$(LI $(BUGZILLA 5781): std.datetime: On Windows, times off by one hour in some years due to DST rule changes)
$(LI $(BUGZILLA 5794): std.datetime StopWatch (and perhaps benchmark) examples need a small fix)
$(LI $(BUGZILLA 5857): std.regex (...){n,m} is bogus when (...) contains repetitions)
$(LI $(BUGZILLA 6076): std.regex: "c.*|d" matches "mm")
$(LI $(BUGZILLA 6076): std.regex: "c.*|d" matches "mm")
)

)
18 changes: 7 additions & 11 deletions std/regex.d
Expand Up @@ -348,10 +348,6 @@ Returns the number of parenthesized captures
//adjust jumps, after removing instructions at 'place'
void fixup(ubyte[] prog, size_t place, uint change)
{
size_t len;
ushort* pu;
uint* dest;

for (size_t pc=0;pc<prog.length;)
{
switch (prog[pc])
Expand All @@ -362,7 +358,7 @@ Returns the number of parenthesized captures
case REcounter: //jump forward
if(pc < place)
{
dest = cast(uint *)&prog[pc + 1 + uint.sizeof];
auto dest = cast(uint *)&prog[pc + 1 + uint.sizeof];
if (pc + *dest > place)
*dest -= change;
}
Expand All @@ -372,7 +368,7 @@ Returns the number of parenthesized captures
case REloop, REloopg: //jump back
if (pc > place)
{
dest = cast(uint *)&prog[pc + 1 + 2*uint.sizeof];
auto dest = cast(uint *)&prog[pc + 1 + 2*uint.sizeof];
if (pc + *dest > place)
*dest += change;
}
Expand All @@ -385,7 +381,7 @@ Returns the number of parenthesized captures
case REgoto:
if (pc < place)
{
dest = cast(uint *)&prog[pc+1];
auto dest = cast(uint *)&prog[pc+1];
if (pc + *dest > place)
*dest -= change;
}
Expand Down Expand Up @@ -422,22 +418,22 @@ Returns the number of parenthesized captures

case REstring:
case REistring:
len = *cast(size_t *)&prog[pc + 1];
auto len = *cast(size_t *)&prog[pc + 1];
assert(len % E.sizeof == 0);
pc += 1 + size_t.sizeof + len;
break;

case REtestbit:
case REbit:
case REnotbit:
pu = cast(ushort *)&prog[pc + 1];
len = pu[1];
auto pu = cast(ushort *)&prog[pc + 1];
auto len = pu[1];
pc += 1 + 2 * ushort.sizeof + len;
break;

case RErange:
case REnotrange:
len = *cast(uint *)&prog[pc + 1];
auto len = *cast(uint *)&prog[pc + 1];
pc += 1 + uint.sizeof + len;
break;

Expand Down

0 comments on commit c7be162

Please sign in to comment.