cubeb-core 0.10.3

Common types and definitions for cubeb rust and C bindings. Not intended for direct use.
Documentation
// Copyright © 2017 Mozilla Foundation
//
// This program is made available under an ISC-style license.  See the
// accompanying file LICENSE for details.

use std::ffi::CStr;
use std::os::raw::c_char;

pub unsafe fn opt_bytes<'a>(c: *const c_char) -> Option<&'a [u8]> {
    if c.is_null() {
        None
    } else {
        Some(CStr::from_ptr(c).to_bytes())
    }
}