Skip to content

Commit

Permalink
Showing 1 changed file with 22 additions and 8 deletions.
30 changes: 22 additions & 8 deletions core/src/main/java/org/jruby/util/Dir.java
Original file line number Diff line number Diff line change
@@ -122,7 +122,18 @@ int helper(byte[] pbytes, int pend, byte[] sbytes, int send, Encoding enc) {
while (true) {
// in place of expected C null char check that falls into default in switch below
if (p >= pend) {
return isEnd(sbytes, s, send) ? 0 : FNM_NOMATCH;
if (isEnd(sbytes, s, send)) {
return 0;
}

// failed: duplicated below due to inability to goto
if (ptmp != -1 && stmp != -1) {
p = ptmp;
stmp++; /* !ISEND(*stmp) */
s = stmp;
continue;
}
return FNM_NOMATCH;
}

switch (pbytes[p]) {
@@ -195,14 +206,17 @@ int helper(byte[] pbytes, int pend, byte[] sbytes, int send, Encoding enc) {
continue;
}

failed: // reached by breaking from above switch rather than continuing
if (ptmp != -1 && stmp != -1) {
p = ptmp;
stmp++; /* !ISEND(*stmp) */
s = stmp;
continue;
// failed: duplicated above due to inability to goto
// reached by breaking from above switch rather than continuing
{
if (ptmp != -1 && stmp != -1) {
p = ptmp;
stmp++; /* !ISEND(*stmp) */
s = stmp;
continue;
}
return FNM_NOMATCH;
}
return FNM_NOMATCH;
}
} finally {
// RETURN macro in MRI

0 comments on commit 3d0e806

Please sign in to comment.