2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-25 03:08:27 +08:00

libproto: simplify (NFC).

This commit is contained in:
whitequark 2017-08-31 02:48:59 +00:00
parent 20f43d5792
commit 4883eea252

View File

@ -8,9 +8,9 @@ unsafe fn recv_value(reader: &mut Read, tag: Tag, data: &mut *mut (),
alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> {
macro_rules! consume_value {
($ty:ty, |$ptr:ident| $map:expr) => ({
let ptr = (*data) as *mut $ty;
*data = ptr.offset(1) as *mut ();
(|$ptr: *mut $ty| $map)(ptr)
let $ptr = (*data) as *mut $ty;
*data = $ptr.offset(1) as *mut ();
$map
})
}
@ -87,9 +87,9 @@ pub fn recv_return(reader: &mut Read, tag_bytes: &[u8], data: *mut (),
unsafe fn send_value(writer: &mut Write, tag: Tag, data: &mut *const ()) -> io::Result<()> {
macro_rules! consume_value {
($ty:ty, |$ptr:ident| $map:expr) => ({
let ptr = (*data) as *const $ty;
*data = ptr.offset(1) as *const ();
(|$ptr: *const $ty| $map)(ptr)
let $ptr = (*data) as *const $ty;
*data = $ptr.offset(1) as *const ();
$map
})
}