forked from M-Labs/artiq
1
0
Fork 0

libproto: simplify (NFC).

This commit is contained in:
whitequark 2017-08-31 02:48:59 +00:00
parent 20f43d5792
commit 4883eea252
1 changed files with 6 additions and 6 deletions

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<()> { alloc: &Fn(usize) -> io::Result<*mut ()>) -> io::Result<()> {
macro_rules! consume_value { macro_rules! consume_value {
($ty:ty, |$ptr:ident| $map:expr) => ({ ($ty:ty, |$ptr:ident| $map:expr) => ({
let ptr = (*data) as *mut $ty; let $ptr = (*data) as *mut $ty;
*data = ptr.offset(1) as *mut (); *data = $ptr.offset(1) as *mut ();
(|$ptr: *mut $ty| $map)(ptr) $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<()> { unsafe fn send_value(writer: &mut Write, tag: Tag, data: &mut *const ()) -> io::Result<()> {
macro_rules! consume_value { macro_rules! consume_value {
($ty:ty, |$ptr:ident| $map:expr) => ({ ($ty:ty, |$ptr:ident| $map:expr) => ({
let ptr = (*data) as *const $ty; let $ptr = (*data) as *const $ty;
*data = ptr.offset(1) as *const (); *data = $ptr.offset(1) as *const ();
(|$ptr: *const $ty| $map)(ptr) $map
}) })
} }