]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/rt/uv/file.rs
Upgrade libuv to the current master (again)
[rust.git] / src / libstd / rt / uv / file.rs
index 0902d5e6d8c2085c08d59b27371bcd2494811ded..45a5fce3f1e8aa0e33575244b98897eb3f73a4f8 100644 (file)
@@ -12,7 +12,7 @@
 use ptr::null;
 use libc::c_void;
 use rt::uv::{Request, NativeHandle, Loop, FsCallback, Buf,
-             status_to_maybe_uv_error_with_loop, UvError};
+             status_to_maybe_uv_error, UvError};
 use rt::uv::uvll;
 use rt::uv::uvll::*;
 use super::super::io::support::PathLike;
@@ -62,7 +62,7 @@ pub fn open<P: PathLike>(loop_: &Loop, path: &P, flags: int, mode: int,
     pub fn open_sync<P: PathLike>(loop_: &Loop, path: &P, flags: int, mode: int)
           -> Result<int, UvError> {
         let result = FsRequest::open_common(loop_, path, flags, mode, None);
-        sync_cleanup(loop_, result)
+        sync_cleanup(result)
     }
 
     fn unlink_common<P: PathLike>(loop_: &Loop, path: &P, cb: Option<FsCallback>) -> int {
@@ -83,11 +83,11 @@ fn unlink_common<P: PathLike>(loop_: &Loop, path: &P, cb: Option<FsCallback>) ->
     }
     pub fn unlink<P: PathLike>(loop_: &Loop, path: &P, cb: FsCallback) {
         let result = FsRequest::unlink_common(loop_, path, Some(cb));
-        sync_cleanup(loop_, result);
+        sync_cleanup(result);
     }
     pub fn unlink_sync<P: PathLike>(loop_: &Loop, path: &P) -> Result<int, UvError> {
         let result = FsRequest::unlink_common(loop_, path, None);
-        sync_cleanup(loop_, result)
+        sync_cleanup(result)
     }
 
     pub fn install_req_data(&self, cb: Option<FsCallback>) {
@@ -140,9 +140,9 @@ fn native_handle(&self) -> *uvll::uv_fs_t {
     }
 }
 
-fn sync_cleanup(loop_: &Loop, result: int)
+fn sync_cleanup(result: int)
     -> Result<int, UvError> {
-    match status_to_maybe_uv_error_with_loop(loop_.native_handle(), result as i32) {
+    match status_to_maybe_uv_error(result as i32) {
         Some(err) => Err(err),
         None => Ok(result)
     }
@@ -186,7 +186,7 @@ pub fn write(&mut self, loop_: &Loop, buf: Buf, offset: i64, cb: FsCallback) {
     pub fn write_sync(&mut self, loop_: &Loop, buf: Buf, offset: i64)
           -> Result<int, UvError> {
         let result = self.write_common(loop_, buf, offset, None);
-        sync_cleanup(loop_, result)
+        sync_cleanup(result)
     }
 
     fn read_common(&mut self, loop_: &Loop, buf: Buf,
@@ -214,7 +214,7 @@ pub fn read(&mut self, loop_: &Loop, buf: Buf, offset: i64, cb: FsCallback) {
     pub fn read_sync(&mut self, loop_: &Loop, buf: Buf, offset: i64)
           -> Result<int, UvError> {
         let result = self.read_common(loop_, buf, offset, None);
-        sync_cleanup(loop_, result)
+        sync_cleanup(result)
     }
 
     fn close_common(self, loop_: &Loop, cb: Option<FsCallback>) -> int {
@@ -236,12 +236,11 @@ pub fn close(self, loop_: &Loop, cb: FsCallback) {
     }
     pub fn close_sync(self, loop_: &Loop) -> Result<int, UvError> {
         let result = self.close_common(loop_, None);
-        sync_cleanup(loop_, result)
+        sync_cleanup(result)
     }
 }
 extern fn compl_cb(req: *uv_fs_t) {
     let mut req: FsRequest = NativeHandle::from_native_handle(req);
-    let loop_ = req.get_loop();
     // pull the user cb out of the req data
     let cb = {
         let data = req.get_req_data();
@@ -252,8 +251,7 @@ pub fn close_sync(self, loop_: &Loop) -> Result<int, UvError> {
     // in uv_fs_open calls, the result will be the fd in the
     // case of success, otherwise it's -1 indicating an error
     let result = req.get_result();
-    let status = status_to_maybe_uv_error_with_loop(
-        loop_.native_handle(), result);
+    let status = status_to_maybe_uv_error(result);
     // we have a req and status, call the user cb..
     // only giving the user a ref to the FsRequest, as we
     // have to clean it up, afterwards (and they aren't really