Skip to content

Commit 86fc8bf

Browse files
committed
---
yaml --- r: 149100 b: refs/heads/try2 c: 6f571a6 h: refs/heads/master v: v3
1 parent 81a315e commit 86fc8bf

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 96139bf1d6eb00d60e8f6521dbf56fc23286723f
8+
refs/heads/try2: 6f571a63a6e966ae59e0d078542c04734eba58ac
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libglob/lib.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#[crate_type = "dylib"];
2929
#[license = "MIT/ASL2"];
3030

31+
use std::cell::Cell;
3132
use std::{os, path};
3233
use std::io::fs;
3334
use std::path::is_sep;
@@ -342,22 +343,24 @@ impl Pattern {
342343
}
343344

344345
fn matches_from(&self,
345-
mut prev_char: Option<char>,
346+
prev_char: Option<char>,
346347
mut file: &str,
347348
i: uint,
348349
options: MatchOptions) -> MatchResult {
349350

351+
let prev_char = Cell::new(prev_char);
352+
350353
let require_literal = |c| {
351354
(options.require_literal_separator && is_sep(c)) ||
352355
(options.require_literal_leading_dot && c == '.'
353-
&& is_sep(prev_char.unwrap_or('/')))
356+
&& is_sep(prev_char.get().unwrap_or('/')))
354357
};
355358

356359
for (ti, token) in self.tokens.slice_from(i).iter().enumerate() {
357360
match *token {
358361
AnySequence => {
359362
loop {
360-
match self.matches_from(prev_char, file, i + ti + 1, options) {
363+
match self.matches_from(prev_char.get(), file, i + ti + 1, options) {
361364
SubPatternDoesntMatch => (), // keep trying
362365
m => return m,
363366
}
@@ -370,7 +373,7 @@ impl Pattern {
370373
if require_literal(c) {
371374
return SubPatternDoesntMatch;
372375
}
373-
prev_char = Some(c);
376+
prev_char.set(Some(c));
374377
file = next;
375378
}
376379
}
@@ -400,7 +403,7 @@ impl Pattern {
400403
if !matches {
401404
return SubPatternDoesntMatch;
402405
}
403-
prev_char = Some(c);
406+
prev_char.set(Some(c));
404407
file = next;
405408
}
406409
}

0 commit comments

Comments
 (0)