Skip to content

Commit 106cc43

Browse files
committed
Merge try_call_panic into try_call
Always check to be sure, and perhaps individual perf-related calls can check more later.
1 parent 216d68f commit 106cc43

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

src/build.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ impl<'cb> RepoBuilder<'cb> {
154154

155155
let mut raw = 0 as *mut raw::git_repository;
156156
unsafe {
157-
try_call_panic!(raw::git_clone(&mut raw, url.to_c_str(),
158-
into.to_c_str(), &opts));
157+
try_call!(raw::git_clone(&mut raw, url.to_c_str(),
158+
into.to_c_str(), &opts));
159159
Ok(Repository::from_raw(raw))
160160
}
161161
}

src/call.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,7 @@ macro_rules! call {
99
)
1010
}
1111

12-
1312
macro_rules! try_call {
14-
($($arg:tt)*) => ({
15-
try!(::call::try(call!($($arg)*)))
16-
})
17-
}
18-
19-
macro_rules! try_call_panic {
2013
($($arg:tt)*) => ({
2114
match ::call::try(call!($($arg)*)) {
2215
Ok(o) => o,
@@ -25,12 +18,6 @@ macro_rules! try_call_panic {
2518
})
2619
}
2720

28-
macro_rules! try_call {
29-
($($arg:tt)*) => ({
30-
try!(::call::try(call!($($arg)*)))
31-
})
32-
}
33-
3421
#[doc(hidden)]
3522
pub trait Convert<T> {
3623
fn convert(&self) -> T;

src/diff.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ impl Diff {
243243
pub fn print<F>(&self, format: DiffFormat, mut cb: F) -> Result<(), Error>
244244
where F: FnMut(DiffDelta, DiffHunk, DiffLine) -> bool {
245245
unsafe {
246-
try_call_panic!(raw::git_diff_print(self.raw, format, print::<F>,
247-
&mut cb as *mut _ as *mut _));
246+
try_call!(raw::git_diff_print(self.raw, format, print::<F>,
247+
&mut cb as *mut _ as *mut _));
248248
return Ok(())
249249
}
250250
extern fn print<F>(delta: *const raw::git_diff_delta,

src/remote.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ impl<'repo, 'cb> Remote<'repo, 'cb> {
9797
pub fn connect(&mut self, dir: Direction) -> Result<(), Error> {
9898
unsafe {
9999
try!(self.set_raw_callbacks());
100-
try_call_panic!(raw::git_remote_connect(self.raw, dir));
100+
try_call!(raw::git_remote_connect(self.raw, dir));
101101
}
102102
Ok(())
103103
}
@@ -217,7 +217,7 @@ impl<'repo, 'cb> Remote<'repo, 'cb> {
217217
unsafe {
218218
try!(self.set_raw_callbacks());
219219
// FIXME expose refspec array at the API level
220-
try_call_panic!(raw::git_remote_download(self.raw, 0 as *const _));
220+
try_call!(raw::git_remote_download(self.raw, 0 as *const _));
221221
}
222222
Ok(())
223223
}
@@ -244,7 +244,7 @@ impl<'repo, 'cb> Remote<'repo, 'cb> {
244244
};
245245
unsafe {
246246
try!(self.set_raw_callbacks());
247-
try_call_panic!(raw::git_remote_fetch(self.raw,
247+
try_call!(raw::git_remote_fetch(self.raw,
248248
&arr,
249249
&*signature.map(|s| s.raw())
250250
.unwrap_or(0 as *mut _),
@@ -276,7 +276,7 @@ impl<'repo, 'cb> Remote<'repo, 'cb> {
276276
let mut ret = 0 as *mut raw::git_push;
277277
try!(self.set_raw_callbacks());
278278
unsafe {
279-
try_call_panic!(raw::git_push_new(&mut ret, self.raw));
279+
try_call!(raw::git_push_new(&mut ret, self.raw));
280280
Ok(Push::from_raw(ret))
281281
}
282282
}

0 commit comments

Comments
 (0)