Skip to content

Commit c6dcaf9

Browse files
garethgareth
authored andcommitted
---
yaml --- r: 57306 b: refs/heads/incoming c: e081c17 h: refs/heads/master v: v3
1 parent 0bb1b0d commit c6dcaf9

File tree

3 files changed

+26
-9
lines changed

3 files changed

+26
-9
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ refs/heads/try: bf67eb2362b7d0f37012f2d6dac604c3bbacd2c6
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/incoming: 7c2a8c4ac2c89a174fdcf4cc68e17e7639a913c6
9+
refs/heads/incoming: e081c17805203b5e87073e2c766280a84b08e52c
1010
refs/heads/dist-snap: 00dbbd01c2aee72982b3e0f9511ae1d4428c3ba9
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/incoming/src/etc/vim/syntax/rust.vim

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,8 @@ syn match rustFloat display "\<[0-9][0-9_]*\.[0-9_]\+\%([eE][+-]\=[0-9
110110
syn match rustLifetime display "\'\%([^[:cntrl:][:space:][:punct:][:digit:]]\|_\)\%([^[:cntrl:][:punct:][:space:]]\|_\)*"
111111
syn match rustCharacter "'\([^'\\]\|\\\(['nrt\\\"]\|x\x\{2}\|u\x\{4}\|U\x\{8}\)\)'"
112112

113-
syn region rustCommentDoc start="/\*\*" end="\*/"
114-
syn region rustCommentDoc start="///" skip="\\$" end="$" keepend
115-
syn match rustComment "/\*\*/"
116-
syn region rustComment start="/\*[^\*]" end="\*/" contains=rustTodo
117-
syn region rustComment start="//[^/]" skip="\\$" end="$" contains=rustTodo keepend
113+
syn region rustComment start="/\*" end="\*/" contains=rustComment,rustTodo
114+
syn region rustComment start="//" skip="\\$" end="$" contains=rustTodo keepend
118115

119116
syn keyword rustTodo contained TODO FIXME XXX NB
120117

@@ -137,7 +134,6 @@ hi def link rustConditional Conditional
137134
hi def link rustIdentifier Identifier
138135
hi def link rustModPath Include
139136
hi def link rustFuncName Function
140-
hi def link rustCommentDoc SpecialComment
141137
hi def link rustComment Comment
142138
hi def link rustMacro Macro
143139
hi def link rustType Type

branches/incoming/src/libcore/run.rs

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,14 @@ fn with_dirp<T>(d: &Option<~str>,
172172
}
173173
}
174174

175+
/// helper function that closes non-NULL files and then makes them NULL
176+
priv unsafe fn fclose_and_null(f: &mut *libc::FILE) {
177+
if *f != 0 as *libc::FILE {
178+
libc::fclose(*f);
179+
*f = 0 as *libc::FILE;
180+
}
181+
}
182+
175183
/**
176184
* Spawns a process and waits for it to terminate
177185
*
@@ -249,8 +257,8 @@ pub fn start_program(prog: &str, args: &[~str]) -> @Program {
249257
fn destroy_repr(r: &mut ProgRepr) {
250258
unsafe {
251259
finish_repr(&mut *r);
252-
libc::fclose(r.out_file);
253-
libc::fclose(r.err_file);
260+
fclose_and_null(&mut r.out_file);
261+
fclose_and_null(&mut r.err_file);
254262
}
255263
}
256264
struct ProgRes {
@@ -507,6 +515,19 @@ mod tests {
507515
assert!(status == 1);
508516
}
509517

518+
#[test]
519+
pub fn test_destroy_once() {
520+
let mut p = run::start_program("echo", []);
521+
p.destroy(); // this shouldn't crash (and nor should the destructor)
522+
}
523+
524+
#[test]
525+
pub fn test_destroy_twice() {
526+
let mut p = run::start_program("echo", []);
527+
p.destroy(); // this shouldnt crash...
528+
p.destroy(); // ...and nor should this (and nor should the destructor)
529+
}
530+
510531
}
511532

512533
// Local Variables:

0 commit comments

Comments
 (0)