@@ -259,21 +259,6 @@ static zval *php_imap_hash_add_object(zval *arg, char *key, zval *tmp)
259
259
}
260
260
/* }}} */
261
261
262
- /* {{{ php_imap_list_add_object */
263
- static inline zval * php_imap_list_add_object (zval * arg , zval * tmp )
264
- {
265
- HashTable * symtable ;
266
-
267
- if (Z_TYPE_P (arg ) == IS_OBJECT ) {
268
- symtable = Z_OBJPROP_P (arg );
269
- } else {
270
- symtable = Z_ARRVAL_P (arg );
271
- }
272
-
273
- return zend_hash_next_index_insert (symtable , tmp );
274
- }
275
- /* }}} */
276
-
277
262
/* {{{ mail_newfolderobjectlist
278
263
*
279
264
* Mail instantiate FOBJECTLIST
@@ -1382,7 +1367,7 @@ static void php_imap_populate_mailbox_object(zval *z_object, const FOBJECTLIST *
1382
1367
/* Author: CJH */
1383
1368
PHP_FUNCTION (imap_getmailboxes )
1384
1369
{
1385
- zval * imap_conn_obj , mboxob ;
1370
+ zval * imap_conn_obj ;
1386
1371
zend_string * ref , * pat ;
1387
1372
php_imap_object * imap_conn_struct ;
1388
1373
FOBJECTLIST * cur = NIL ;
@@ -1405,9 +1390,10 @@ PHP_FUNCTION(imap_getmailboxes)
1405
1390
array_init (return_value );
1406
1391
cur = IMAPG (imap_folder_objects );
1407
1392
while (cur != NIL ) {
1393
+ zval mboxob ;
1408
1394
object_init (& mboxob );
1409
1395
php_imap_populate_mailbox_object (& mboxob , cur );
1410
- php_imap_list_add_object ( return_value , & mboxob );
1396
+ zend_hash_next_index_insert_new ( Z_ARR_P ( return_value ) , & mboxob );
1411
1397
cur = cur -> next ;
1412
1398
}
1413
1399
mail_free_foblist (& IMAPG (imap_folder_objects ), & IMAPG (imap_folder_objects_tail ));
@@ -1741,7 +1727,7 @@ PHP_FUNCTION(imap_lsub)
1741
1727
/* Author: CJH */
1742
1728
PHP_FUNCTION (imap_getsubscribed )
1743
1729
{
1744
- zval * imap_conn_obj , mboxob ;
1730
+ zval * imap_conn_obj ;
1745
1731
zend_string * ref , * pat ;
1746
1732
php_imap_object * imap_conn_struct ;
1747
1733
FOBJECTLIST * cur = NIL ;
@@ -1764,12 +1750,14 @@ PHP_FUNCTION(imap_getsubscribed)
1764
1750
}
1765
1751
1766
1752
array_init (return_value );
1767
- cur = IMAPG (imap_sfolder_objects );
1753
+ cur = IMAPG (imap_sfolder_objects );
1768
1754
while (cur != NIL ) {
1755
+ zval mboxob ;
1769
1756
object_init (& mboxob );
1770
1757
php_imap_populate_mailbox_object (& mboxob , cur );
1771
- php_imap_list_add_object (return_value , & mboxob );
1772
- cur = cur -> next ;
1758
+ zend_hash_next_index_insert_new (Z_ARR_P (return_value ), & mboxob );
1759
+
1760
+ cur = cur -> next ;
1773
1761
}
1774
1762
mail_free_foblist (& IMAPG (imap_sfolder_objects ), & IMAPG (imap_sfolder_objects_tail ));
1775
1763
IMAPG (folderlist_style ) = FLIST_ARRAY ; /* reset to default */
@@ -2197,14 +2185,14 @@ static void php_imap_construct_address_object(zval *z_object, const ADDRESS *add
2197
2185
}
2198
2186
}
2199
2187
2200
- static void php_imap_construct_list_of_addresses (zval * list , const ADDRESS * const address_list )
2188
+ static void php_imap_construct_list_of_addresses (HashTable * list , const ADDRESS * const address_list )
2201
2189
{
2202
2190
const ADDRESS * current_address = address_list ;
2203
2191
do {
2204
2192
zval tmp_object ;
2205
2193
object_init (& tmp_object );
2206
2194
php_imap_construct_address_object (& tmp_object , current_address );
2207
- php_imap_list_add_object (list , & tmp_object );
2195
+ zend_hash_next_index_insert_new (list , & tmp_object );
2208
2196
} while ((current_address = current_address -> next ));
2209
2197
}
2210
2198
@@ -2232,7 +2220,7 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
2232
2220
address_list = env -> to ;
2233
2221
2234
2222
if (address_list ) {
2235
- php_imap_construct_list_of_addresses (return_value , address_list );
2223
+ php_imap_construct_list_of_addresses (Z_ARR_P ( return_value ) , address_list );
2236
2224
}
2237
2225
2238
2226
mail_free_envelope (& env );
@@ -2969,7 +2957,7 @@ static void php_imap_populate_body_struct_object(zval *z_object, const BODY *bod
2969
2957
"value" , strlen ("value" ),
2970
2958
disposition_parameter -> value
2971
2959
);
2972
- php_imap_list_add_object ( & z_disposition_parameter_list , & z_disposition_parameter );
2960
+ zend_hash_next_index_insert_new ( Z_ARR ( z_disposition_parameter_list ) , & z_disposition_parameter );
2973
2961
} while ((disposition_parameter = disposition_parameter -> next ));
2974
2962
php_imap_hash_add_object (z_object , "dparameters" , & z_disposition_parameter_list );
2975
2963
} else {
@@ -3006,7 +2994,7 @@ static void php_imap_populate_body_struct_object(zval *z_object, const BODY *bod
3006
2994
body_parameters -> value
3007
2995
);
3008
2996
3009
- php_imap_list_add_object ( & z_body_parameter_list , & z_body_parameter );
2997
+ zend_hash_next_index_insert_new ( Z_ARR ( z_body_parameter_list ) , & z_body_parameter );
3010
2998
} while ((body_parameters = body_parameters -> next ));
3011
2999
} else {
3012
3000
object_init (& z_body_parameter_list );
@@ -3193,7 +3181,8 @@ PHP_FUNCTION(imap_fetch_overview)
3193
3181
"udate" , strlen ("udate" ),
3194
3182
mail_longdate (elt )
3195
3183
);
3196
- php_imap_list_add_object (return_value , & myoverview );
3184
+
3185
+ zend_hash_next_index_insert_new (Z_ARR_P (return_value ), & myoverview );
3197
3186
}
3198
3187
}
3199
3188
}
@@ -4246,7 +4235,7 @@ static zend_string* _php_imap_parse_address (ADDRESS *address_list, zval *paddre
4246
4235
4247
4236
fulladdress = _php_rfc822_write_address (addresstmp );
4248
4237
4249
- php_imap_construct_list_of_addresses (paddress , address_list );
4238
+ php_imap_construct_list_of_addresses (Z_ARR_P ( paddress ) , address_list );
4250
4239
return fulladdress ;
4251
4240
}
4252
4241
/* }}} */
@@ -4442,7 +4431,7 @@ void _php_imap_add_body(zval *arg, const BODY *body)
4442
4431
zval z_content_part ;
4443
4432
object_init (& z_content_part );
4444
4433
_php_imap_add_body (& z_content_part , & content_part -> body );
4445
- php_imap_list_add_object ( & z_content_part_list , & z_content_part );
4434
+ zend_hash_next_index_insert_new ( Z_ARR ( z_content_part_list ) , & z_content_part );
4446
4435
}
4447
4436
php_imap_hash_add_object (arg , "parts" , & z_content_part_list );
4448
4437
}
@@ -4455,7 +4444,7 @@ void _php_imap_add_body(zval *arg, const BODY *body)
4455
4444
array_init (& message_list );
4456
4445
object_init (& message );
4457
4446
_php_imap_add_body (& message , message_body );
4458
- php_imap_list_add_object ( & message_list , & message );
4447
+ zend_hash_next_index_insert_new ( Z_ARR ( message_list ) , & message );
4459
4448
php_imap_hash_add_object (arg , "parts" , & message_list );
4460
4449
}
4461
4450
}
0 commit comments