@@ -72,7 +72,7 @@ void php_g_hash_table_free_storage(zend_object *object)
72
72
{
73
73
TRACE ();
74
74
75
- php_g_hash_table * intern = PHP_G_HASH_TABLE_FROM_STD (object );
75
+ php_g_hash_table * intern = ZOBJ_TO_PHP_G_HASH_TABLE (object );
76
76
php_glib_object * parent = PHP_GLIB_OBJECT (& intern -> parent_instance );
77
77
78
78
current_hash_table = intern ;
@@ -87,7 +87,7 @@ void php_g_hash_table_free_storage(zend_object *object)
87
87
zval * php_g_hash_table_get_property_ptr_ptr (zval * object , zval * member , int type , void * * cache_slot ) /* {{{ */
88
88
{
89
89
TRACE ();
90
- php_g_hash_table * obj = PHP_G_HASH_TABLE_FROM_STD ( Z_OBJ_P ( object ) );
90
+ php_g_hash_table * obj = ZVAL_GET_PHP_G_HASH_TABLE ( object );
91
91
php_glib_object * parent = & obj -> parent_instance ;
92
92
zend_string * member_str = zval_get_string (member );
93
93
zval * retval = NULL ;
@@ -107,7 +107,7 @@ zval *php_g_hash_table_get_property_ptr_ptr(zval *object, zval *member, int type
107
107
zval * php_g_hash_table_read_property (zval * object , zval * member , int type , void * * cache_slot , zval * rv )
108
108
{
109
109
TRACE ();
110
- php_g_hash_table * obj = PHP_G_HASH_TABLE_FROM_STD ( Z_OBJ_P ( object ) );
110
+ php_g_hash_table * obj = ZVAL_GET_PHP_G_HASH_TABLE ( object );
111
111
php_glib_object * parent = & obj -> parent_instance ;
112
112
zend_string * member_str = zval_get_string (member );
113
113
zval * retval ;
@@ -141,7 +141,7 @@ zval *php_g_hash_table_read_property(zval *object, zval *member, int type, void
141
141
void php_g_hash_table_write_property (zval * object , zval * member , zval * value , void * * cache_slot )
142
142
{
143
143
TRACE ();
144
- php_g_hash_table * obj = PHP_G_HASH_TABLE_FROM_STD ( Z_OBJ_P ( object ) );
144
+ php_g_hash_table * obj = ZVAL_GET_PHP_G_HASH_TABLE ( object );
145
145
php_glib_object * parent = & obj -> parent_instance ;
146
146
zend_string * member_str = zval_get_string (member );
147
147
php_g_hash_table_prop_handler * hnd = NULL ;
@@ -200,7 +200,7 @@ php_g_hash_table_get_debug_info_helper(zval *object, int *is_temp) /* {{{ */
200
200
{
201
201
TRACE ();
202
202
203
- php_g_hash_table * obj = PHP_G_HASH_TABLE_FROM_STD ( Z_OBJ_P ( object ) );
203
+ php_g_hash_table * obj = ZVAL_GET_PHP_G_HASH_TABLE ( object );
204
204
php_glib_object * parent = & obj -> parent_instance ;
205
205
HashTable * debug_info ,
206
206
* prop_handlers = obj -> prop_handler ,
@@ -262,20 +262,11 @@ while (g_hash_table_iter_next (&iter, (gpointer)&key, (gpointer)&value))
262
262
} else {
263
263
g_print ("Unexpected 21 : php_g_hash_table_get_debug_info_helper\n" );
264
264
}
265
- /*
266
- if (Z_TYPE_P(value)==IS_STRING) {
267
- ZVAL_COPY(&val, value);
268
- } else if (Z_TYPE_P(value)==IS_OBJECT ) {
269
- ZVAL_COPY(&val, value);
270
- } else {
271
- g_print("Unexpected 21 : php_g_hash_table_get_debug_info_helper\n");
272
- }
273
- */
274
265
275
266
//g_print("%s=>%s\n", (char *)k->value.str->val, (char *)val.value.str->val);
276
267
zend_hash_add (debug_info , k .value .str , value );
277
- // Z_TRY_DELREF(k);
278
- //Z_TRY_DELREF_P (value);
268
+ Z_TRY_DELREF (k );
269
+ Z_TRY_ADDREF_P (value );
279
270
280
271
}
281
272
return debug_info ;
@@ -303,7 +294,7 @@ php_g_hash_table_has_dimension(zval *object, zval *member, int check_empty)
303
294
//zval *length = zend_read_property(Z_OBJCE_P(object), object, "length", sizeof("length") - 1, 0, &rv);
304
295
305
296
//return length && offset < Z_LVAL_P(length);
306
- php_g_hash_table * intern = PHP_G_HASH_TABLE_FROM_STD ( Z_OBJCE_P ( object ) );
297
+ php_g_hash_table * intern = ZVAL_GET_PHP_G_HASH_TABLE ( object );
307
298
GHashTable * hash_table = intern -> parent_instance .ptr ;
308
299
guint size = g_hash_table_size (hash_table );
309
300
return size > 0 ;
@@ -322,7 +313,7 @@ php_g_hash_table_read_dimension(zval *object, zval *offset, int type, zval *rv)
322
313
323
314
324
315
//ZVAL_LONG(&offset_copy, zval_get_long(offset));
325
- php_g_hash_table * intern = PHP_G_HASH_TABLE_FROM_STD ( Z_OBJ_P ( object ) );
316
+ php_g_hash_table * intern = ZVAL_GET_PHP_G_HASH_TABLE ( object );
326
317
GHashTable * hash_table = intern -> parent_instance .ptr ;
327
318
zval * value = NULL ;
328
319
if (hash_table != NULL ) {
@@ -434,8 +425,8 @@ php_g_hash_table_hash_func(gconstpointer v) {
434
425
ZVAL_STRING (& params [0 ], name );
435
426
g_free (name );
436
427
}
437
- g_print ("!!!%p\n" , hash_func );
438
- g_print ("%d\n" , Z_TYPE_P (hash_func ));
428
+ // g_print("!!!%p\n", hash_func);
429
+ // g_print("%d\n", Z_TYPE_P(hash_func));
439
430
result = call_user_function (NULL , NULL , hash_func , & retval , param_count , params );
440
431
if (result == FAILURE ) {
441
432
g_print ("Unexpected 22 : php_g_hash_table_hash_func\n" );
@@ -548,7 +539,7 @@ php_g_hash_table_new(zval *hash_func, zval *key_equal_func)
548
539
{
549
540
TRACE ();
550
541
zend_object * object = php_g_hash_table_create_object (php_g_hash_table_class_entry );
551
- php_g_hash_table * hash_table = PHP_G_HASH_TABLE_FROM_STD (object );
542
+ php_g_hash_table * hash_table = ZOBJ_TO_PHP_G_HASH_TABLE (object );
552
543
php_glib_object * obj = PHP_GLIB_OBJECT (& hash_table -> parent_instance );
553
544
554
545
@@ -572,7 +563,7 @@ php_g_hash_table_new(zval *hash_func, zval *key_equal_func)
572
563
hash_table -> key_equal_func = NULL ;
573
564
}
574
565
575
- return PHP_G_HASH_TABLE_FROM_STD ( object ) ;
566
+ return hash_table ;
576
567
}
577
568
578
569
zend_bool
@@ -660,7 +651,7 @@ PHP_FUNCTION(g_hash_table_insert)
660
651
if (zend_parse_parameters (ZEND_NUM_ARGS (), "ozz" , & hash_table , & key , & value ) == FAILURE ) {
661
652
return ;
662
653
}
663
- php_g_hash_table * obj = PHP_G_HASH_TABLE_FROM_STD (hash_table -> value . obj );
654
+ php_g_hash_table * obj = ZVAL_GET_PHP_G_HASH_TABLE (hash_table );
664
655
zend_bool ret = php_g_hash_table_insert (obj , key , value );
665
656
RETURN_BOOL (ret );
666
657
}
@@ -679,7 +670,7 @@ PHP_FUNCTION(g_hash_table_add)
679
670
Z_PARAM_ZVAL (key );
680
671
ZEND_PARSE_PARAMETERS_END ();
681
672
682
- php_g_hash_table * __self = PHP_G_HASH_TABLE_FROM_STD (hash_table -> value . obj );
673
+ php_g_hash_table * __self = ZVAL_GET_PHP_G_HASH_TABLE (hash_table );
683
674
zend_bool __ret = php_g_hash_table_add (__self , key );
684
675
685
676
//Z_TRY_DELREF(*hash_table);
0 commit comments