summaryrefslogtreecommitdiffstats
path: root/third_party/rust/cubeb-core/src/call.rs
blob: 4a78b054e99e4ac509441c8876d28f8136f38601 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright © 2017-2018 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.
#![macro_use]

use std::os::raw::c_int;
use Error;

pub fn cvt_r(ret: c_int) -> Result<(), Error> {
    match ret {
        n if n < 0 => Err(Error::from_raw(n)),
        _ => Ok(()),
    }
}

macro_rules! call {
    (ffi::$p:ident ($($e:expr),*)) => ({
        ::call::cvt_r(ffi::$p($($e),*))
    })
}