Bug 1888590 - Mark some subtests on trusted-types-event-handlers.html as failing...
[gecko.git] / third_party / rust / cubeb-core / src / util.rs
blob33008b668efd67af4a9e7022c0997796b1df9845
1 // Copyright © 2017 Mozilla Foundation
2 //
3 // This program is made available under an ISC-style license.  See the
4 // accompanying file LICENSE for details.
6 use std::ffi::CStr;
7 use std::os::raw::c_char;
9 pub unsafe fn opt_bytes<'a>(c: *const c_char) -> Option<&'a [u8]> {
10     if c.is_null() {
11         None
12     } else {
13         Some(CStr::from_ptr(c).to_bytes())
14     }