Remove uses of 'break' in std lib; rustc doesn't support it yet, this is easier for now.
This commit is contained in:
parent
e1d2899553
commit
6a6a30b792
@ -52,7 +52,8 @@ state obj FILE_reader(os.libc.FILE f, bool must_close) {
|
||||
auto buf = "";
|
||||
while (true) {
|
||||
auto ch = os.libc.fgetc(f);
|
||||
if (ch == -1) {break;} if (ch == 10) {break;}
|
||||
if (ch == -1) { ret buf; }
|
||||
if (ch == 10) { ret buf; }
|
||||
buf += _str.unsafe_from_bytes(vec(ch as u8));
|
||||
}
|
||||
ret buf;
|
||||
@ -61,7 +62,7 @@ state obj FILE_reader(os.libc.FILE f, bool must_close) {
|
||||
auto buf = "";
|
||||
while (true) {
|
||||
auto ch = os.libc.fgetc(f);
|
||||
if (ch < 1) {break;}
|
||||
if (ch < 1) { ret buf; }
|
||||
buf += _str.unsafe_from_bytes(vec(ch as u8));
|
||||
}
|
||||
ret buf;
|
||||
|
@ -9,7 +9,10 @@ impure fn list_dir(str path) -> vec[str] {
|
||||
let vec[str] result = vec();
|
||||
while (true) {
|
||||
auto ent = os.libc.readdir(dir);
|
||||
if (ent as int == 0) {break;}
|
||||
if (ent as int == 0) {
|
||||
os.libc.closedir(dir);
|
||||
ret result;
|
||||
}
|
||||
_vec.push[str](result, rustrt.rust_dirent_filename(ent));
|
||||
}
|
||||
os.libc.closedir(dir);
|
||||
|
Loading…
x
Reference in New Issue
Block a user