mirror of https://github.com/m-labs/artiq.git
libproto: simplify (NFC).
This commit is contained in:
parent
20f43d5792
commit
4883eea252
|
@ -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
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue