Skip to content

Commit 84e3370

Browse files
committed
use init class macros and ifdef out stuff touching default properties for now on 5.4
1 parent e349ad9 commit 84e3370

2 files changed

Lines changed: 6 additions & 13 deletions

File tree

main/phpg_gobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ static PHP_METHOD(GObject, register_type)
14191419
zend_declare_class_constant_long(class, "gtype", sizeof("gtype")-1, new_type TSRMLS_CC);
14201420

14211421
zend_update_class_constants(class TSRMLS_CC);
1422-
1422+
#if PHP_VERSION_ID < 50399
14231423
/* register properties */
14241424
if (zend_hash_find(&class->default_properties, "__gproperties", sizeof("__gproperties"), (void**)&prop_decls) == SUCCESS) {
14251425
if (Z_TYPE_PP(prop_decls) != IS_ARRAY) {
@@ -1455,7 +1455,7 @@ static PHP_METHOD(GObject, register_type)
14551455
}
14561456
zend_hash_del(&class->default_properties, "__gsignals", sizeof("__gsignals"));
14571457
}
1458-
1458+
#endif
14591459
if (free_name) {
14601460
g_free(type_name);
14611461
}

main/phpg_support.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ PHP_GTK_API void phpg_init_object(void *object, zend_class_entry *ce TSRMLS_DC)
271271

272272
poh->pi_hash = NULL;
273273

274-
#if PHP_VERSION_ID < 50399
274+
#if PHP_VERSION_ID < 50399
275275
zend_hash_copy(poh->zobj.properties, &(ce->default_properties),
276276
(copy_ctor_func_t)zval_add_ref, (void *)(&tmp),
277277
sizeof(zval *));
@@ -288,7 +288,7 @@ PHP_GTK_API void phpg_init_object(void *object, zend_class_entry *ce TSRMLS_DC)
288288
prop_ce = prop_ce->parent;
289289
}
290290

291-
zend_hash_find(&phpg_prop_info, prop_ce->name, prop_ce->name_length+1, (void **) &poh->pi_hash);
291+
//zend_hash_find(&phpg_prop_info, prop_ce->name, prop_ce->name_length+1, (void **) &poh->pi_hash);
292292
}
293293
/* }}} */
294294

@@ -311,11 +311,7 @@ PHP_GTK_API zend_class_entry* phpg_register_class(const char *class_name,
311311
phpg_class_key = g_quark_from_static_string(phpg_class_id);
312312
}
313313

314-
memset(&ce, 0, sizeof(ce));
315-
316-
ce.name = strdup(class_name);
317-
ce.name_length = strlen(class_name);
318-
ce.builtin_functions = class_methods;
314+
INIT_CLASS_ENTRY_EX(ce, strdup(class_name), strlen(class_name), class_methods);
319315

320316
real_ce = zend_register_internal_class_ex(&ce, parent, NULL TSRMLS_CC);
321317

@@ -365,10 +361,7 @@ PHP_GTK_API zend_class_entry* phpg_register_interface(const char *iface_name,
365361
phpg_class_key = g_quark_from_static_string(phpg_class_id);
366362
}
367363

368-
memset(&ce, 0, sizeof(ce));
369-
ce.name = strdup(iface_name);
370-
ce.name_length = strlen(iface_name);
371-
ce.builtin_functions = iface_methods;
364+
INIT_CLASS_ENTRY_EX(ce, strdup(iface_name), strlen(iface_name), iface_methods);
372365

373366
real_ce = zend_register_internal_interface(&ce TSRMLS_CC);
374367

0 commit comments

Comments
 (0)