diff --git a/enum.c b/enum.c index 329a7d1..1b19ab0 100644 --- a/enum.c +++ b/enum.c @@ -36,7 +36,7 @@ PHP_MINIT_FUNCTION(gintrospection_Enums) zend_class_entry flags_ce; INIT_NS_CLASS_ENTRY(error_ce, ZEND_NS_NAME(GINTROSPECTION_NAMESPACE, "Repository"), "Error", NULL); - ce_gintrospection_repositoryerror = zend_register_internal_class_ex(&error_ce, ce_glib_enum, NULL TSRMLS_CC); + ce_gintrospection_repositoryerror = zend_register_internal_class_ex(&error_ce, ce_glib_enum); REGISTER_ENUM_CONST("TYPELIB_NOT_FOUND", G_IREPOSITORY_ERROR_TYPELIB_NOT_FOUND, ce_gintrospection_repositoryerror); REGISTER_ENUM_CONST("NAMESPACE_MISMATCH", G_IREPOSITORY_ERROR_NAMESPACE_MISMATCH, ce_gintrospection_repositoryerror); @@ -44,12 +44,12 @@ PHP_MINIT_FUNCTION(gintrospection_Enums) REGISTER_ENUM_CONST("LIBRARY_NOT_FOUND", G_IREPOSITORY_ERROR_LIBRARY_NOT_FOUND, ce_gintrospection_repositoryerror); INIT_NS_CLASS_ENTRY(lazy_ce, ZEND_NS_NAME(GINTROSPECTION_NAMESPACE, "Repository"), "LoadFlags", NULL); - ce_gintrospection_repositoryloadflags = zend_register_internal_class_ex(&lazy_ce, ce_glib_enum, NULL TSRMLS_CC); + ce_gintrospection_repositoryloadflags = zend_register_internal_class_ex(&lazy_ce, ce_glib_enum); REGISTER_ENUM_CONST("LAZY", G_IREPOSITORY_LOAD_FLAG_LAZY, ce_gintrospection_repositoryloadflags); INIT_NS_CLASS_ENTRY(info_ce, GINTROSPECTION_NAMESPACE, "InfoType", NULL); - ce_gintrospection_infotype = zend_register_internal_class_ex(&info_ce, ce_glib_enum, NULL TSRMLS_CC); + ce_gintrospection_infotype = zend_register_internal_class_ex(&info_ce, ce_glib_enum); REGISTER_ENUM_CONST("INVALID", GI_INFO_TYPE_INVALID, ce_gintrospection_infotype); REGISTER_ENUM_CONST("FUNCTION", GI_INFO_TYPE_FUNCTION, ce_gintrospection_infotype); @@ -72,7 +72,7 @@ PHP_MINIT_FUNCTION(gintrospection_Enums) REGISTER_ENUM_CONST("UNRESOLVED", GI_INFO_TYPE_UNRESOLVED, ce_gintrospection_infotype); INIT_NS_CLASS_ENTRY(flags_ce, ZEND_NS_NAME(GINTROSPECTION_NAMESPACE, "VFuncInfo"), "Flags", NULL); - ce_gintrospection_vfuncinfoflags = zend_register_internal_class_ex(&flags_ce, ce_glib_enum, NULL TSRMLS_CC); + ce_gintrospection_vfuncinfoflags = zend_register_internal_class_ex(&flags_ce, ce_glib_enum); REGISTER_ENUM_CONST("MUST_CHAIN_UP", GI_VFUNC_MUST_CHAIN_UP, ce_gintrospection_vfuncinfoflags); REGISTER_ENUM_CONST("MUST_OVERRIDE", GI_VFUNC_MUST_OVERRIDE, ce_gintrospection_vfuncinfoflags); @@ -80,7 +80,7 @@ PHP_MINIT_FUNCTION(gintrospection_Enums) REGISTER_ENUM_CONST("THROWS", GI_VFUNC_THROWS, ce_gintrospection_vfuncinfoflags); INIT_NS_CLASS_ENTRY(tags_ce, ZEND_NS_NAME(GINTROSPECTION_NAMESPACE, "TypeInfo"), "Tag", NULL); - ce_gintrospection_typetag = zend_register_internal_class_ex(&tags_ce, ce_glib_enum, NULL TSRMLS_CC); + ce_gintrospection_typetag = zend_register_internal_class_ex(&tags_ce, ce_glib_enum); REGISTER_ENUM_CONST("VOID", GI_TYPE_TAG_VOID, ce_gintrospection_typetag); REGISTER_ENUM_CONST("BOOLEAN", GI_TYPE_TAG_BOOLEAN, ce_gintrospection_typetag); diff --git a/info.c b/info.c index e1770d2..e7fd103 100644 --- a/info.c +++ b/info.c @@ -143,7 +143,7 @@ PHP_METHOD(BaseInfo, getTypeName) type = g_base_info_get_type(baseinfo_object->info); name = g_info_type_to_string(type); - RETURN_STRING(name, 1); + RETURN_STRING(name); } /* }}} */ @@ -162,7 +162,7 @@ PHP_METHOD(BaseInfo, getName) baseinfo_object = (gintrospection_baseinfo_object *) zend_object_store_get_object(getThis() TSRMLS_CC); - RETURN_STRING(g_base_info_get_name(baseinfo_object->info), 1); + RETURN_STRING(g_base_info_get_name(baseinfo_object->info)); } /* }}} */ @@ -181,7 +181,7 @@ PHP_METHOD(BaseInfo, getNameSpace) baseinfo_object = (gintrospection_baseinfo_object *) zend_object_store_get_object(getThis() TSRMLS_CC); - RETURN_STRING(g_base_info_get_namespace(baseinfo_object->info), 1); + RETURN_STRING(g_base_info_get_namespace(baseinfo_object->info)); } /* }}} */ @@ -225,7 +225,7 @@ PHP_METHOD(BaseInfo, getAttribute) value = g_base_info_get_attribute(baseinfo_object->info, name); if(value) { - RETURN_STRING(value, 1); + RETURN_STRING(value); } } @@ -250,7 +250,7 @@ PHP_METHOD(BaseInfo, getAttributes) array_init(return_value); while (g_base_info_iterate_attributes (baseinfo_object->info, &iter, &name, &value)) { - add_assoc_string(return_value, name, value, 1); + add_assoc_string(return_value, name, value); } } @@ -358,7 +358,7 @@ PHP_METHOD(RegisteredTypeInfo, getGTypeName) name = g_registered_type_info_get_type_name(baseinfo_object->info); if (name) { - RETURN_STRING(name, 1); + RETURN_STRING(name); } } /* }}} */ @@ -383,7 +383,7 @@ PHP_METHOD(RegisteredTypeInfo, getTypeInit) name = g_registered_type_info_get_type_init(baseinfo_object->info); if (name) { - RETURN_STRING(name, 1); + RETURN_STRING(name); } } /* }}} */ @@ -659,7 +659,7 @@ PHP_METHOD(ValueInfo, getValue) item = g_value_info_get_value(baseinfo_object->info); value = g_strdup_printf("%"G_GINT64_FORMAT, item); - RETVAL_STRING(value, 1); + RETVAL_STRING(value); g_free(value); } /* }}} */ @@ -942,7 +942,7 @@ PHP_METHOD(StructInfo, getSize) item = g_struct_info_get_size(baseinfo_object->info); value = g_strdup_printf("%"G_GSIZE_FORMAT, item); - RETVAL_STRING(value, 1); + RETVAL_STRING(value); g_free(value); } /* }}} */ @@ -968,7 +968,7 @@ PHP_METHOD(StructInfo, getAlignment) item = g_struct_info_get_alignment(baseinfo_object->info); value = g_strdup_printf("%"G_GSIZE_FORMAT, item); - RETVAL_STRING(value, 1); + RETVAL_STRING(value); g_free(value); } /* }}} */ @@ -1392,7 +1392,7 @@ PHP_METHOD(UnionInfo, getSize) item = g_union_info_get_size(baseinfo_object->info); value = g_strdup_printf("%"G_GSIZE_FORMAT, item); - RETVAL_STRING(value, 1); + RETVAL_STRING(value); g_free(value); } /* }}} */ @@ -1418,7 +1418,7 @@ PHP_METHOD(UnionInfo, getAlignment) item = g_union_info_get_alignment(baseinfo_object->info); value = g_strdup_printf("%"G_GSIZE_FORMAT, item); - RETVAL_STRING(value, 1); + RETVAL_STRING(value); g_free(value); } /* }}} */ @@ -1444,24 +1444,21 @@ static void gintrospection_baseinfo_object_free(void *object TSRMLS_DC) /* }}} */ /* {{{ gintrospection_baseinfo_object_create */ -static zend_object_value gintrospection_baseinfo_object_create(zend_class_entry *ce TSRMLS_DC) +static zend_object* gintrospection_baseinfo_object_create(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; gintrospection_baseinfo_object *baseinfo_object; - baseinfo_object = ecalloc(1, sizeof(gintrospection_baseinfo_object)); + baseinfo_object = ecalloc(1, sizeof(gintrospection_baseinfo_object)+ + sizeof(zend_object_properties_size(ce))); zend_object_std_init((zend_object *) baseinfo_object, ce TSRMLS_CC); baseinfo_object->is_constructed = FALSE; baseinfo_object->info = NULL; object_properties_init(&baseinfo_object->std, ce); - retval.handle = zend_objects_store_put(baseinfo_object, - (zend_objects_store_dtor_t) zend_objects_destroy_object, - (zend_objects_free_object_storage_t) gintrospection_baseinfo_object_free, - NULL TSRMLS_CC); - retval.handlers = &std_object_handlers; - return retval; + + baseinfo_object->std.handlers = &std_object_handlers; + return &baseinfo_object->std; } /* }}} */ @@ -1574,67 +1571,67 @@ PHP_MINIT_FUNCTION(gintrospection_Info) ce_gintrospection_baseinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(callable_ce, GINTROSPECTION_NAMESPACE, "CallableInfo", NULL); - ce_gintrospection_callableinfo = zend_register_internal_class_ex(&callable_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_callableinfo = zend_register_internal_class_ex(&callable_ce, ce_gintrospection_baseinfo); ce_gintrospection_callableinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(function_ce, GINTROSPECTION_NAMESPACE, "FunctionInfo", NULL); - ce_gintrospection_functioninfo = zend_register_internal_class_ex(&function_ce, ce_gintrospection_callableinfo, NULL TSRMLS_CC); + ce_gintrospection_functioninfo = zend_register_internal_class_ex(&function_ce, ce_gintrospection_callableinfo); ce_gintrospection_functioninfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(signal_ce, GINTROSPECTION_NAMESPACE, "SignalInfo", NULL); - ce_gintrospection_signalinfo = zend_register_internal_class_ex(&signal_ce, ce_gintrospection_callableinfo, NULL TSRMLS_CC); + ce_gintrospection_signalinfo = zend_register_internal_class_ex(&signal_ce, ce_gintrospection_callableinfo); ce_gintrospection_signalinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(vfunc_ce, GINTROSPECTION_NAMESPACE, "VFuncInfo", NULL); - ce_gintrospection_vfuncinfo = zend_register_internal_class_ex(&vfunc_ce, ce_gintrospection_callableinfo, NULL TSRMLS_CC); + ce_gintrospection_vfuncinfo = zend_register_internal_class_ex(&vfunc_ce, ce_gintrospection_callableinfo); ce_gintrospection_vfuncinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(regtype_ce, GINTROSPECTION_NAMESPACE, "RegisteredTypeInfo", gi_regtypeinfo_methods); - ce_gintrospection_regtypeinfo = zend_register_internal_class_ex(®type_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_regtypeinfo = zend_register_internal_class_ex(®type_ce, ce_gintrospection_baseinfo); ce_gintrospection_regtypeinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(enum_ce, GINTROSPECTION_NAMESPACE, "EnumInfo", gi_enuminfo_methods); - ce_gintrospection_enuminfo = zend_register_internal_class_ex(&enum_ce, ce_gintrospection_regtypeinfo, NULL TSRMLS_CC); + ce_gintrospection_enuminfo = zend_register_internal_class_ex(&enum_ce, ce_gintrospection_regtypeinfo); ce_gintrospection_enuminfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(union_ce, GINTROSPECTION_NAMESPACE, "UnionInfo", gi_unioninfo_methods); - ce_gintrospection_unioninfo = zend_register_internal_class_ex(&union_ce, ce_gintrospection_regtypeinfo, NULL TSRMLS_CC); + ce_gintrospection_unioninfo = zend_register_internal_class_ex(&union_ce, ce_gintrospection_regtypeinfo); ce_gintrospection_unioninfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(struct_ce, GINTROSPECTION_NAMESPACE, "StructInfo", gi_structinfo_methods); - ce_gintrospection_structinfo = zend_register_internal_class_ex(&struct_ce, ce_gintrospection_regtypeinfo, NULL TSRMLS_CC); + ce_gintrospection_structinfo = zend_register_internal_class_ex(&struct_ce, ce_gintrospection_regtypeinfo); ce_gintrospection_structinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(object_ce, GINTROSPECTION_NAMESPACE, "ObjectInfo", NULL); - ce_gintrospection_objectinfo = zend_register_internal_class_ex(&object_ce, ce_gintrospection_regtypeinfo, NULL TSRMLS_CC); + ce_gintrospection_objectinfo = zend_register_internal_class_ex(&object_ce, ce_gintrospection_regtypeinfo); ce_gintrospection_objectinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(interface_ce, GINTROSPECTION_NAMESPACE, "InterfaceInfo", NULL); - ce_gintrospection_interfaceinfo = zend_register_internal_class_ex(&interface_ce, ce_gintrospection_regtypeinfo, NULL TSRMLS_CC); + ce_gintrospection_interfaceinfo = zend_register_internal_class_ex(&interface_ce, ce_gintrospection_regtypeinfo); ce_gintrospection_interfaceinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(arginfo_ce, GINTROSPECTION_NAMESPACE, "ArgInfo", NULL); - ce_gintrospection_arginfo = zend_register_internal_class_ex(&arginfo_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_arginfo = zend_register_internal_class_ex(&arginfo_ce, ce_gintrospection_baseinfo); ce_gintrospection_arginfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(constant_ce, GINTROSPECTION_NAMESPACE, "ConstantInfo", NULL); - ce_gintrospection_constantinfo = zend_register_internal_class_ex(&constant_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_constantinfo = zend_register_internal_class_ex(&constant_ce, ce_gintrospection_baseinfo); ce_gintrospection_constantinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(field_ce, GINTROSPECTION_NAMESPACE, "FieldInfo", NULL); - ce_gintrospection_fieldinfo = zend_register_internal_class_ex(&field_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_fieldinfo = zend_register_internal_class_ex(&field_ce, ce_gintrospection_baseinfo); ce_gintrospection_fieldinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(property_ce, GINTROSPECTION_NAMESPACE, "PropertyInfo", NULL); - ce_gintrospection_propertyinfo = zend_register_internal_class_ex(&property_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_propertyinfo = zend_register_internal_class_ex(&property_ce, ce_gintrospection_baseinfo); ce_gintrospection_propertyinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(type_ce, GINTROSPECTION_NAMESPACE, "TypeInfo", NULL); - ce_gintrospection_typeinfo = zend_register_internal_class_ex(&type_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_typeinfo = zend_register_internal_class_ex(&type_ce, ce_gintrospection_baseinfo); ce_gintrospection_typeinfo->create_object = gintrospection_baseinfo_object_create; INIT_NS_CLASS_ENTRY(value_ce, GINTROSPECTION_NAMESPACE, "ValueInfo", gi_valueinfo_methods); - ce_gintrospection_valueinfo = zend_register_internal_class_ex(&value_ce, ce_gintrospection_baseinfo, NULL TSRMLS_CC); + ce_gintrospection_valueinfo = zend_register_internal_class_ex(&value_ce, ce_gintrospection_baseinfo); ce_gintrospection_valueinfo->create_object = gintrospection_baseinfo_object_create; return SUCCESS; diff --git a/repository.c b/repository.c index ac437af..bb9d04b 100644 --- a/repository.c +++ b/repository.c @@ -172,7 +172,7 @@ PHP_METHOD(Repository, getSearchPath) { data = g_slist_nth_data(list, i); - add_next_index_string(return_value, (char *) data, 1); + add_next_index_string(return_value, (char *) data); } } /* }}} */ @@ -362,7 +362,7 @@ PHP_METHOD(Repository, getDependencies) if (NULL != dependencies) { for (i = 0; dependencies[i] != NULL; i++) { - add_next_index_string(return_value, dependencies[i], 1); + add_next_index_string(return_value, dependencies[i]); g_free(dependencies[i]); } @@ -392,7 +392,7 @@ PHP_METHOD(Repository, getLoadedNamespaces) array_init(return_value); for (i = 0; namespaces[i] != NULL; i++) { - add_next_index_string(return_value, namespaces[i], 1); + add_next_index_string(return_value, namespaces[i]); g_free(namespaces[i]); } @@ -561,7 +561,7 @@ PHP_METHOD(Repository, getTypelibPath) return; } - RETURN_STRING(g_irepository_get_typelib_path(repository_object->repo, name), 1); + RETURN_STRING(g_irepository_get_typelib_path(repository_object->repo, name)); } /* }}} */ @@ -596,7 +596,7 @@ PHP_METHOD(Repository, getSharedLibrary) if(NULL == path) { RETURN_NULL(); } else { - RETURN_STRING(path, 1); + RETURN_STRING(path); } } /* }}} */ @@ -625,7 +625,7 @@ PHP_METHOD(Repository, getVersion) return; } - RETURN_STRING(g_irepository_get_version(repository_object->repo, name), 1); + RETURN_STRING(g_irepository_get_version(repository_object->repo, name)); } /* }}} */ @@ -653,7 +653,7 @@ PHP_METHOD(Repository, getCPrefix) return; } - RETURN_STRING(g_irepository_get_c_prefix(repository_object->repo, name), 1); + RETURN_STRING(g_irepository_get_c_prefix(repository_object->repo, name)); } /* }}} */ @@ -711,7 +711,7 @@ PHP_METHOD(Repository, enumerateVersions) array_init(return_value); for (item = versions; item; item = item->next) { - add_next_index_string(return_value, item->data, 1); + add_next_index_string(return_value, item->data); } g_list_free(versions); @@ -736,24 +736,20 @@ static void gintrospection_repository_object_free(void *object TSRMLS_DC) /* }}} */ /* {{{ gintrospection_repository_object_create */ -static zend_object_value gintrospection_repository_object_create(zend_class_entry *ce TSRMLS_DC) +static zend_object* gintrospection_repository_object_create(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; gintrospection_repository_object *repository_object; - repository_object = ecalloc(1, sizeof(gintrospection_repository_object)); + repository_object = ecalloc(1, sizeof(gintrospection_repository_object)+ + sizeof(zend_objecT_properties_size(ce))); zend_object_std_init((zend_object *) repository_object, ce TSRMLS_CC); repository_object->is_constructed = FALSE; repository_object->repo = NULL; object_properties_init(&repository_object->std, ce); - retval.handle = zend_objects_store_put(repository_object, - (zend_objects_store_dtor_t) zend_objects_destroy_object, - (zend_objects_free_object_storage_t) gintrospection_repository_object_free, - NULL TSRMLS_CC); - retval.handlers = &gintrospection_repository_object_handlers; - return retval; + repository_object->std.handlers = &gintrospection_repository_object_handlers; + return &repository_object->std; } /* }}} */ diff --git a/typelib.c b/typelib.c index 555db08..4cb3be9 100644 --- a/typelib.c +++ b/typelib.c @@ -51,7 +51,7 @@ PHP_METHOD(Typelib, getNamespace) typelib_object = (gintrospection_typelib_object *) zend_object_store_get_object(getThis() TSRMLS_CC); - RETURN_STRING(g_typelib_get_namespace(typelib_object->typelib), 1); + RETURN_STRING(g_typelib_get_namespace(typelib_object->typelib)); } /* }}} */ @@ -73,24 +73,20 @@ static void gintrospection_typelib_object_free(void *object TSRMLS_DC) /* }}} */ /* {{{ gintrospection_typelib_object_create */ -static zend_object_value gintrospection_typelib_object_create(zend_class_entry *ce TSRMLS_DC) +static zend_object* gintrospection_typelib_object_create(zend_class_entry *ce TSRMLS_DC) { - zend_object_value retval; gintrospection_typelib_object *typelib_object; - typelib_object = ecalloc(1, sizeof(gintrospection_typelib_object)); + typelib_object = ecalloc(1, sizeof(gintrospection_typelib_object)+ + sizeof(zend_object_properties_size(ce))); zend_object_std_init((zend_object *) typelib_object, ce TSRMLS_CC); typelib_object->is_constructed = FALSE; typelib_object->typelib = NULL; object_properties_init(&typelib_object->std, ce); - retval.handle = zend_objects_store_put(typelib_object, - (zend_objects_store_dtor_t) zend_objects_destroy_object, - (zend_objects_free_object_storage_t) gintrospection_typelib_object_free, - NULL TSRMLS_CC); - retval.handlers = &std_object_handlers; - return retval; + typelib_object->std.handlers = &std_object_handlers; + return &typelib_object->std; } /* }}} */