Sha256: 93366c426f7ecac8db80be8eaf7d6e5e9f71a2d57da1eb1acc0d626f8a9086d6

Contents?: true

Size: 873 Bytes

Versions: 8

Compression:

Stored size: 873 Bytes

Contents

use core::mem::transmute;
use rb_sys::*;
use std::ffi::c_void;

// Convert str literal to C string literal
macro_rules! cstr {
    ($s:expr) => {
        concat!($s, "\0").as_ptr() as *const std::ffi::c_char
    };
}
pub(crate) use cstr;

pub type RubyCFunc = unsafe extern "C" fn() -> VALUE;

// TODO: rewrite as macro
pub fn to_ruby_cfunc_with_no_args<T>(f: unsafe extern "C" fn(T) -> VALUE) -> RubyCFunc {
    unsafe { transmute::<unsafe extern "C" fn(T) -> VALUE, RubyCFunc>(f) }
}
pub fn to_ruby_cfunc_with_args<T, U, V>(f: unsafe extern "C" fn(T, U, V) -> VALUE) -> RubyCFunc {
    unsafe { transmute::<unsafe extern "C" fn(T, U, V) -> VALUE, RubyCFunc>(f) }
}

#[allow(non_snake_case)]
pub fn RTEST(v: VALUE) -> bool {
    v != Qfalse as VALUE && v != Qnil as VALUE
}

extern "C" {
    pub fn extract_si_value_sival_ptr(info: *mut libc::siginfo_t) -> *mut c_void;
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
pf2-0.7.1 ext/pf2/src/util.rs
pf2-0.7.0 ext/pf2/src/util.rs
pf2-0.6.0 ext/pf2/src/util.rs
pf2-0.5.2 ext/pf2/src/util.rs
pf2-0.5.1 ext/pf2/src/util.rs
pf2-0.5.0 ext/pf2/src/util.rs
pf2-0.4.0 ext/pf2/src/util.rs
pf2-0.3.0 ext/pf2/src/util.rs