bools for arginfo

This commit is contained in:
Robin Appelman 2019-03-18 23:36:55 +01:00
commit 56cd9d6968
2 changed files with 10 additions and 9 deletions

View file

@ -36,8 +36,8 @@ pub extern "C" fn get_module() -> *mut zend::Module {
entry.set_info_func(php_module_info); entry.set_info_func(php_module_info);
let args = vec![ let args = vec![
ArgInfo::new(c_str!("name"), 0, 0, 0), ArgInfo::new(c_str!("name"), false, false, false),
ArgInfo::new(c_str!("foo"), 0, 0, 0), ArgInfo::new(c_str!("foo"), false, false, false),
]; ];
let funcs = vec![ let funcs = vec![

View file

@ -2,6 +2,7 @@ use std;
use std::mem; use std::mem;
use libc::*; use libc::*;
use std::ffi::{CString, CStr};
type StartupFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int; type StartupFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int;
type ShutdownFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int; type ShutdownFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int;
@ -30,17 +31,17 @@ pub struct ArgInfo {
impl ArgInfo { impl ArgInfo {
pub fn new( pub fn new(
name: *const c_char, name: *const c_char,
allow_null: c_uchar, allow_null: bool,
is_variadic: c_uchar, is_variadic: bool,
by_reference: c_uchar, by_reference: bool,
) -> ArgInfo { ) -> ArgInfo {
ArgInfo { ArgInfo {
name, name,
class_name: std::ptr::null(), class_name: std::ptr::null(),
type_hint: 0, type_hint: 0,
pass_by_reference: by_reference, pass_by_reference: by_reference as c_uchar,
allow_null, allow_null: allow_null as c_uchar,
is_variadic, is_variadic: is_variadic as c_uchar,
} }
} }
} }
@ -72,7 +73,7 @@ impl Function {
) -> Function { ) -> Function {
let num_args = args.len() as u32; let num_args = args.len() as u32;
let arg_count = ArgInfo::new(num_args as *const c_char, 0, 0, 0); let arg_count = ArgInfo::new(num_args as *const c_char, false, false, false);
args.insert(0, arg_count); args.insert(0, arg_count);
let arg_ptr = args.as_ptr(); let arg_ptr = args.as_ptr();