summaryrefslogtreecommitdiff
path: root/ext/ffi
diff options
context:
space:
mode:
Diffstat (limited to 'ext/ffi')
-rw-r--r--ext/ffi/ffi.c64
-rw-r--r--ext/ffi/ffi.g10
-rw-r--r--ext/ffi/ffi_parser.c10
-rw-r--r--ext/ffi/php_ffi.h10
4 files changed, 47 insertions, 47 deletions
diff --git a/ext/ffi/ffi.c b/ext/ffi/ffi.c
index 2ca1cad90d..e18da8bf7a 100644
--- a/ext/ffi/ffi.c
+++ b/ext/ffi/ffi.c
@@ -124,8 +124,8 @@ struct _zend_ffi_type {
typedef struct _zend_ffi_field {
size_t offset;
- zend_bool is_const;
- zend_bool is_nested; /* part of nested anonymous struct */
+ bool is_const;
+ bool is_nested; /* part of nested anonymous struct */
uint8_t first_bit;
uint8_t bits;
zend_ffi_type *type;
@@ -140,7 +140,7 @@ typedef enum _zend_ffi_symbol_kind {
typedef struct _zend_ffi_symbol {
zend_ffi_symbol_kind kind;
- zend_bool is_const;
+ bool is_const;
zend_ffi_type *type;
union {
void *addr;
@@ -158,7 +158,7 @@ typedef struct _zend_ffi {
DL_HANDLE lib;
HashTable *symbols;
HashTable *tags;
- zend_bool persistent;
+ bool persistent;
} zend_ffi;
#define ZEND_FFI_TYPE_OWNED (1<<0)
@@ -209,7 +209,7 @@ static void _zend_ffi_type_dtor(zend_ffi_type *type);
static void zend_ffi_finalize_type(zend_ffi_dcl *dcl);
static int zend_ffi_is_same_type(zend_ffi_type *type1, zend_ffi_type *type2);
static zend_ffi_type *zend_ffi_remember_type(zend_ffi_type *type);
-static char *zend_ffi_parse_directives(const char *filename, char *code_pos, char **scope_name, char **lib, zend_bool preload);
+static char *zend_ffi_parse_directives(const char *filename, char *code_pos, char **scope_name, char **lib, bool preload);
static ZEND_FUNCTION(ffi_trampoline);
static ZEND_COLD void zend_ffi_return_unsupported(zend_ffi_type *type);
static ZEND_COLD void zend_ffi_pass_unsupported(zend_ffi_type *type);
@@ -458,7 +458,7 @@ static zend_never_inline zend_ffi_cdata *zend_ffi_cdata_to_zval_slow_ret(void *p
}
/* }}} */
-static zend_always_inline void zend_ffi_cdata_to_zval(zend_ffi_cdata *cdata, void *ptr, zend_ffi_type *type, int read_type, zval *rv, zend_ffi_flags flags, zend_bool is_ret, zend_bool debug_union) /* {{{ */
+static zend_always_inline void zend_ffi_cdata_to_zval(zend_ffi_cdata *cdata, void *ptr, zend_ffi_type *type, int read_type, zval *rv, zend_ffi_flags flags, bool is_ret, bool debug_union) /* {{{ */
{
if (read_type == BP_VAR_R) {
zend_ffi_type_kind kind = type->kind;
@@ -1802,7 +1802,7 @@ typedef struct _zend_ffi_cdata_iterator {
zend_object_iterator it;
zend_long key;
zval value;
- zend_bool by_ref;
+ bool by_ref;
} zend_ffi_cdata_iterator;
static void zend_ffi_cdata_it_dtor(zend_object_iterator *iter) /* {{{ */
@@ -2007,7 +2007,7 @@ static HashTable *zend_ffi_cdata_get_debug_info(zend_object *obj, int *is_temp)
}
/* }}} */
-static int zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, zend_bool check_only) /* {{{ */
+static int zend_ffi_cdata_get_closure(zend_object *obj, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zend_object **obj_ptr, bool check_only) /* {{{ */
{
zend_ffi_cdata *cdata = (zend_ffi_cdata*)obj;
zend_ffi_type *type = ZEND_FFI_TYPE(cdata->type);
@@ -3103,7 +3103,7 @@ static zend_ffi_type *zend_ffi_remember_type(zend_ffi_type *type) /* {{{ */
}
/* }}} */
-static zend_ffi *zend_ffi_load(const char *filename, zend_bool preload) /* {{{ */
+static zend_ffi *zend_ffi_load(const char *filename, bool preload) /* {{{ */
{
struct stat buf;
int fd;
@@ -3460,7 +3460,7 @@ static int zend_ffi_validate_vla(zend_ffi_type *type) /* {{{ */
}
/* }}} */
-static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, zend_bool allow_incomplete_tag, zend_bool allow_incomplete_array) /* {{{ */
+static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, bool allow_incomplete_tag, bool allow_incomplete_array) /* {{{ */
{
if (!allow_incomplete_tag && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_TAG)) {
if (FFI_G(tags)) {
@@ -3504,7 +3504,7 @@ static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, zend_bool allo
}
/* }}} */
-static int zend_ffi_validate_type(zend_ffi_type *type, zend_bool allow_incomplete_tag, zend_bool allow_incomplete_array) /* {{{ */
+static int zend_ffi_validate_type(zend_ffi_type *type, bool allow_incomplete_tag, bool allow_incomplete_array) /* {{{ */
{
if (type->kind == ZEND_FFI_TYPE_VOID) {
zend_ffi_throw_parser_error("void type is not allowed at line %d", FFI_G(line));
@@ -3514,7 +3514,7 @@ static int zend_ffi_validate_type(zend_ffi_type *type, zend_bool allow_incomplet
}
/* }}} */
-static int zend_ffi_validate_var_type(zend_ffi_type *type, zend_bool allow_incomplete_array) /* {{{ */
+static int zend_ffi_validate_var_type(zend_ffi_type *type, bool allow_incomplete_array) /* {{{ */
{
if (type->kind == ZEND_FFI_TYPE_FUNC) {
zend_ffi_throw_parser_error("function type is not allowed at line %d", FFI_G(line));
@@ -3598,9 +3598,9 @@ ZEND_METHOD(FFI, new) /* {{{ */
zend_ffi_type *type, *type_ptr;
zend_ffi_cdata *cdata;
void *ptr;
- zend_bool owned = 1;
- zend_bool persistent = 0;
- zend_bool is_const = 0;
+ bool owned = 1;
+ bool persistent = 0;
+ bool is_const = 0;
zend_ffi_flags flags = ZEND_FFI_FLAG_OWNED;
ZEND_FFI_VALIDATE_API_RESTRICTION();
@@ -3717,7 +3717,7 @@ ZEND_METHOD(FFI, free) /* {{{ */
ZEND_FFI_VALIDATE_API_RESTRICTION();
ZEND_PARSE_PARAMETERS_START(1, 1)
- Z_PARAM_OBJECT_OF_CLASS_EX2(zv, zend_ffi_cdata_ce, 0, 1, 0);
+ Z_PARAM_OBJECT_OF_CLASS_EX(zv, zend_ffi_cdata_ce, 0, 1);
ZEND_PARSE_PARAMETERS_END();
cdata = (zend_ffi_cdata*)Z_OBJ_P(zv);
@@ -3750,7 +3750,7 @@ ZEND_METHOD(FFI, cast) /* {{{ */
zend_object *ztype = NULL;
zend_ffi_type *old_type, *type, *type_ptr;
zend_ffi_cdata *old_cdata, *cdata;
- zend_bool is_const = 0;
+ bool is_const = 0;
zval *zv, *arg;
void *ptr;
@@ -4208,7 +4208,7 @@ ZEND_METHOD(FFI, memcpy) /* {{{ */
ZEND_FFI_VALIDATE_API_RESTRICTION();
ZEND_PARSE_PARAMETERS_START(3, 3)
- Z_PARAM_OBJECT_OF_CLASS_EX2(zv1, zend_ffi_cdata_ce, 0, 1, 0);
+ Z_PARAM_OBJECT_OF_CLASS_EX(zv1, zend_ffi_cdata_ce, 0, 1);
Z_PARAM_ZVAL(zv2)
Z_PARAM_LONG(size)
ZEND_PARSE_PARAMETERS_END();
@@ -4338,7 +4338,7 @@ ZEND_METHOD(FFI, memset) /* {{{ */
ZEND_FFI_VALIDATE_API_RESTRICTION();
ZEND_PARSE_PARAMETERS_START(3, 3)
- Z_PARAM_OBJECT_OF_CLASS_EX2(zv, zend_ffi_cdata_ce, 0, 1, 0);
+ Z_PARAM_OBJECT_OF_CLASS_EX(zv, zend_ffi_cdata_ce, 0, 1);
Z_PARAM_LONG(ch)
Z_PARAM_LONG(size)
ZEND_PARSE_PARAMETERS_END();
@@ -4366,11 +4366,11 @@ ZEND_METHOD(FFI, string) /* {{{ */
zend_ffi_type *type;
void *ptr;
zend_long size;
- zend_bool size_is_null = 1;
+ bool size_is_null = 1;
ZEND_FFI_VALIDATE_API_RESTRICTION();
ZEND_PARSE_PARAMETERS_START(1, 2)
- Z_PARAM_OBJECT_OF_CLASS_EX2(zv, zend_ffi_cdata_ce, 0, 1, 0);
+ Z_PARAM_OBJECT_OF_CLASS_EX(zv, zend_ffi_cdata_ce, 0, 1);
Z_PARAM_OPTIONAL
Z_PARAM_LONG_OR_NULL(size, size_is_null)
ZEND_PARSE_PARAMETERS_END();
@@ -4451,7 +4451,7 @@ ZEND_METHOD(FFI_CType, getName) /* {{{ */
}
}
-static char *zend_ffi_parse_directives(const char *filename, char *code_pos, char **scope_name, char **lib, zend_bool preload) /* {{{ */
+static char *zend_ffi_parse_directives(const char *filename, char *code_pos, char **scope_name, char **lib, bool preload) /* {{{ */
{
char *p;
@@ -4815,7 +4815,7 @@ static int zend_ffi_preload(char *preload) /* {{{ */
{
zend_ffi *ffi;
char *s = NULL, *e, *filename;
- zend_bool is_glob = 0;
+ bool is_glob = 0;
e = preload;
while (*e) {
@@ -5419,8 +5419,8 @@ void zend_ffi_add_enum_val(zend_ffi_dcl *enum_dcl, const char *name, size_t name
const zend_ffi_type *sym_type;
int64_t value;
zend_ffi_type *enum_type = ZEND_FFI_TYPE(enum_dcl->type);
- zend_bool overflow = 0;
- zend_bool is_signed =
+ bool overflow = 0;
+ bool is_signed =
(enum_type->enumeration.kind == ZEND_FFI_TYPE_SINT8 ||
enum_type->enumeration.kind == ZEND_FFI_TYPE_SINT16 ||
enum_type->enumeration.kind == ZEND_FFI_TYPE_SINT32 ||
@@ -5605,7 +5605,7 @@ void zend_ffi_add_field(zend_ffi_dcl *struct_dcl, const char *name, size_t name_
struct_type->size += field_type->size;
}
field->type = field_dcl->type;
- field->is_const = (zend_bool)(field_dcl->attr & ZEND_FFI_ATTR_CONST);
+ field->is_const = (bool)(field_dcl->attr & ZEND_FFI_ATTR_CONST);
field->is_nested = 0;
field->first_bit = 0;
field->bits = 0;
@@ -5773,7 +5773,7 @@ void zend_ffi_add_bit_field(zend_ffi_dcl *struct_dcl, const char *name, size_t n
}
}
field->type = field_dcl->type;
- field->is_const = (zend_bool)(field_dcl->attr & ZEND_FFI_ATTR_CONST);
+ field->is_const = (bool)(field_dcl->attr & ZEND_FFI_ATTR_CONST);
field->is_nested = 0;
field_dcl->type = field_type; /* reset "owned" flag */
@@ -6092,7 +6092,7 @@ void zend_ffi_declare(const char *name, size_t name_len, zend_ffi_dcl *dcl) /* {
if ((dcl->flags & ZEND_FFI_DCL_STORAGE_CLASS) == ZEND_FFI_DCL_TYPEDEF
&& sym->kind == ZEND_FFI_SYM_TYPE
&& zend_ffi_is_same_type(ZEND_FFI_TYPE(sym->type), ZEND_FFI_TYPE(dcl->type))
- && sym->is_const == (zend_bool)(dcl->attr & ZEND_FFI_ATTR_CONST)) {
+ && sym->is_const == (bool)(dcl->attr & ZEND_FFI_ATTR_CONST)) {
/* allowed redeclaration */
zend_ffi_type_dtor(dcl->type);
return;
@@ -6110,7 +6110,7 @@ void zend_ffi_declare(const char *name, size_t name_len, zend_ffi_dcl *dcl) /* {
} else {
if (sym->kind == ZEND_FFI_SYM_VAR
&& zend_ffi_is_same_type(ZEND_FFI_TYPE(sym->type), type)
- && sym->is_const == (zend_bool)(dcl->attr & ZEND_FFI_ATTR_CONST)) {
+ && sym->is_const == (bool)(dcl->attr & ZEND_FFI_ATTR_CONST)) {
/* allowed redeclaration */
zend_ffi_type_dtor(dcl->type);
return;
@@ -6139,7 +6139,7 @@ void zend_ffi_declare(const char *name, size_t name_len, zend_ffi_dcl *dcl) /* {
sym = pemalloc(sizeof(zend_ffi_symbol), FFI_G(persistent));
sym->kind = ZEND_FFI_SYM_TYPE;
sym->type = dcl->type;
- sym->is_const = (zend_bool)(dcl->attr & ZEND_FFI_ATTR_CONST);
+ sym->is_const = (bool)(dcl->attr & ZEND_FFI_ATTR_CONST);
dcl->type = ZEND_FFI_TYPE(dcl->type); /* reset "owned" flag */
zend_hash_str_add_new_ptr(FFI_G(symbols), name, name_len, sym);
} else {
@@ -6155,7 +6155,7 @@ void zend_ffi_declare(const char *name, size_t name_len, zend_ffi_dcl *dcl) /* {
sym = pemalloc(sizeof(zend_ffi_symbol), FFI_G(persistent));
sym->kind = (type->kind == ZEND_FFI_TYPE_FUNC) ? ZEND_FFI_SYM_FUNC : ZEND_FFI_SYM_VAR;
sym->type = dcl->type;
- sym->is_const = (zend_bool)(dcl->attr & ZEND_FFI_ATTR_CONST);
+ sym->is_const = (bool)(dcl->attr & ZEND_FFI_ATTR_CONST);
dcl->type = type; /* reset "owned" flag */
zend_hash_str_add_new_ptr(FFI_G(symbols), name, name_len, sym);
} else {
@@ -6167,7 +6167,7 @@ void zend_ffi_declare(const char *name, size_t name_len, zend_ffi_dcl *dcl) /* {
}
/* }}} */
-void zend_ffi_declare_tag(const char *name, size_t name_len, zend_ffi_dcl *dcl, zend_bool incomplete) /* {{{ */
+void zend_ffi_declare_tag(const char *name, size_t name_len, zend_ffi_dcl *dcl, bool incomplete) /* {{{ */
{
zend_ffi_tag *tag;
zend_ffi_type *type;
diff --git a/ext/ffi/ffi.g b/ext/ffi/ffi.g
index 4d7c003906..0dd94dfb6d 100644
--- a/ext/ffi/ffi.g
+++ b/ext/ffi/ffi.g
@@ -335,7 +335,7 @@ enumerator(zend_ffi_dcl *enum_dcl, int64_t *min, int64_t *max, int64_t *last):
declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len):
{zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};}
- {zend_bool nested = 0;}
+ {bool nested = 0;}
pointer(dcl)?
( ID(name, name_len)
| "("
@@ -350,7 +350,7 @@ declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len):
abstract_declarator(zend_ffi_dcl *dcl):
{zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};}
- {zend_bool nested = 0;}
+ {bool nested = 0;}
pointer(dcl)?
( &nested_declarator_start
"("
@@ -365,7 +365,7 @@ abstract_declarator(zend_ffi_dcl *dcl):
parameter_declarator(zend_ffi_dcl *dcl, const char **name, size_t *name_len):
{zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};}
- {zend_bool nested = 0;}
+ {bool nested = 0;}
pointer(dcl)?
( &nested_declarator_start
"("
@@ -440,7 +440,7 @@ array_or_function_declarators(zend_ffi_dcl *dcl, zend_ffi_dcl *nested_dcl):
parameter_declaration(HashTable **args):
{const char *name = NULL;}
{size_t name_len = 0;}
- {zend_bool old_allow_vla = FFI_G(allow_vla);}
+ {bool old_allow_vla = FFI_G(allow_vla);}
{FFI_G(allow_vla) = 1;}
{zend_ffi_dcl param_dcl = ZEND_FFI_ATTR_INIT;}
specifier_qualifier_list(&param_dcl)
@@ -498,7 +498,7 @@ attrib(zend_ffi_dcl *dcl):
{size_t name_len;}
{int n;}
{zend_ffi_val val;}
- {zend_bool orig_attribute_parsing;}
+ {bool orig_attribute_parsing;}
( ID(&name, &name_len)
( /* empty */
{zend_ffi_add_attribute(dcl, name, name_len);}
diff --git a/ext/ffi/ffi_parser.c b/ext/ffi/ffi_parser.c
index 03d05eb6d9..d50c6f4abf 100644
--- a/ext/ffi/ffi_parser.c
+++ b/ext/ffi/ffi_parser.c
@@ -2569,7 +2569,7 @@ static int parse_enumerator(int sym, zend_ffi_dcl *enum_dcl, int64_t *min, int64
static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) {
zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};
- zend_bool nested = 0;
+ bool nested = 0;
if (sym == YY__STAR) {
sym = parse_pointer(sym, dcl);
}
@@ -2598,7 +2598,7 @@ static int parse_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_
static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl) {
zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};
- zend_bool nested = 0;
+ bool nested = 0;
if (sym == YY__STAR) {
sym = parse_pointer(sym, dcl);
}
@@ -2623,7 +2623,7 @@ static int parse_abstract_declarator(int sym, zend_ffi_dcl *dcl) {
static int parse_parameter_declarator(int sym, zend_ffi_dcl *dcl, const char **name, size_t *name_len) {
zend_ffi_dcl nested_dcl = {ZEND_FFI_DCL_CHAR, 0, 0, 0, NULL};
- zend_bool nested = 0;
+ bool nested = 0;
if (sym == YY__STAR) {
sym = parse_pointer(sym, dcl);
}
@@ -2863,7 +2863,7 @@ _yy_state_119:
static int parse_parameter_declaration(int sym, HashTable **args) {
const char *name = NULL;
size_t name_len = 0;
- zend_bool old_allow_vla = FFI_G(allow_vla);
+ bool old_allow_vla = FFI_G(allow_vla);
FFI_G(allow_vla) = 1;
zend_ffi_dcl param_dcl = ZEND_FFI_ATTR_INIT;
sym = parse_specifier_qualifier_list(sym, &param_dcl);
@@ -2965,7 +2965,7 @@ static int parse_attrib(int sym, zend_ffi_dcl *dcl) {
size_t name_len;
int n;
zend_ffi_val val;
- zend_bool orig_attribute_parsing;
+ bool orig_attribute_parsing;
if (sym == YY_ID || sym == YY_CONST || sym == YY___CONST || sym == YY___CONST__) {
if (sym == YY_ID) {
sym = parse_ID(sym, &name, &name_len);
diff --git a/ext/ffi/php_ffi.h b/ext/ffi/php_ffi.h
index 3a10b45478..4b395dc83d 100644
--- a/ext/ffi/php_ffi.h
+++ b/ext/ffi/php_ffi.h
@@ -30,7 +30,7 @@ typedef struct _zend_ffi_type zend_ffi_type;
ZEND_BEGIN_MODULE_GLOBALS(ffi)
zend_ffi_api_restriction restriction;
- zend_bool is_cli;
+ bool is_cli;
/* predefined ffi_types */
HashTable types;
@@ -54,9 +54,9 @@ ZEND_BEGIN_MODULE_GLOBALS(ffi)
int line;
HashTable *symbols;
HashTable *tags;
- zend_bool allow_vla;
- zend_bool attribute_parsing;
- zend_bool persistent;
+ bool allow_vla;
+ bool attribute_parsing;
+ bool persistent;
uint32_t default_type_attr;
ZEND_END_MODULE_GLOBALS(ffi)
@@ -214,7 +214,7 @@ void ZEND_NORETURN zend_ffi_parser_error(const char *msg, ...);
int zend_ffi_is_typedef_name(const char *name, size_t name_len);
void zend_ffi_resolve_typedef(const char *name, size_t name_len, zend_ffi_dcl *dcl);
void zend_ffi_resolve_const(const char *name, size_t name_len, zend_ffi_val *val);
-void zend_ffi_declare_tag(const char *name, size_t name_len, zend_ffi_dcl *dcl, zend_bool incomplete);
+void zend_ffi_declare_tag(const char *name, size_t name_len, zend_ffi_dcl *dcl, bool incomplete);
void zend_ffi_make_enum_type(zend_ffi_dcl *dcl);
void zend_ffi_add_enum_val(zend_ffi_dcl *enum_dcl, const char *name, size_t name_len, zend_ffi_val *val, int64_t *min, int64_t *max, int64_t *last);
void zend_ffi_make_struct_type(zend_ffi_dcl *dcl);