@@ -259,21 +259,6 @@ static zval *php_imap_hash_add_object(zval *arg, char *key, zval *tmp)
259259}
260260/* }}} */
261261
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-
277262/* {{{ mail_newfolderobjectlist
278263 *
279264 * Mail instantiate FOBJECTLIST
@@ -1382,7 +1367,7 @@ static void php_imap_populate_mailbox_object(zval *z_object, const FOBJECTLIST *
13821367/* Author: CJH */
13831368PHP_FUNCTION (imap_getmailboxes )
13841369{
1385- zval * imap_conn_obj , mboxob ;
1370+ zval * imap_conn_obj ;
13861371 zend_string * ref , * pat ;
13871372 php_imap_object * imap_conn_struct ;
13881373 FOBJECTLIST * cur = NIL ;
@@ -1405,9 +1390,10 @@ PHP_FUNCTION(imap_getmailboxes)
14051390 array_init (return_value );
14061391 cur = IMAPG (imap_folder_objects );
14071392 while (cur != NIL ) {
1393+ zval mboxob ;
14081394 object_init (& mboxob );
14091395 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 );
14111397 cur = cur -> next ;
14121398 }
14131399 mail_free_foblist (& IMAPG (imap_folder_objects ), & IMAPG (imap_folder_objects_tail ));
@@ -1741,7 +1727,7 @@ PHP_FUNCTION(imap_lsub)
17411727/* Author: CJH */
17421728PHP_FUNCTION (imap_getsubscribed )
17431729{
1744- zval * imap_conn_obj , mboxob ;
1730+ zval * imap_conn_obj ;
17451731 zend_string * ref , * pat ;
17461732 php_imap_object * imap_conn_struct ;
17471733 FOBJECTLIST * cur = NIL ;
@@ -1764,12 +1750,14 @@ PHP_FUNCTION(imap_getsubscribed)
17641750 }
17651751
17661752 array_init (return_value );
1767- cur = IMAPG (imap_sfolder_objects );
1753+ cur = IMAPG (imap_sfolder_objects );
17681754 while (cur != NIL ) {
1755+ zval mboxob ;
17691756 object_init (& mboxob );
17701757 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 ;
17731761 }
17741762 mail_free_foblist (& IMAPG (imap_sfolder_objects ), & IMAPG (imap_sfolder_objects_tail ));
17751763 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
21972185 }
21982186}
21992187
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 )
22012189{
22022190 const ADDRESS * current_address = address_list ;
22032191 do {
22042192 zval tmp_object ;
22052193 object_init (& tmp_object );
22062194 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 );
22082196 } while ((current_address = current_address -> next ));
22092197}
22102198
@@ -2232,7 +2220,7 @@ PHP_FUNCTION(imap_rfc822_parse_adrlist)
22322220 address_list = env -> to ;
22332221
22342222 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 );
22362224 }
22372225
22382226 mail_free_envelope (& env );
@@ -2969,7 +2957,7 @@ static void php_imap_populate_body_struct_object(zval *z_object, const BODY *bod
29692957 "value" , strlen ("value" ),
29702958 disposition_parameter -> value
29712959 );
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 );
29732961 } while ((disposition_parameter = disposition_parameter -> next ));
29742962 php_imap_hash_add_object (z_object , "dparameters" , & z_disposition_parameter_list );
29752963 } else {
@@ -3006,7 +2994,7 @@ static void php_imap_populate_body_struct_object(zval *z_object, const BODY *bod
30062994 body_parameters -> value
30072995 );
30082996
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 );
30102998 } while ((body_parameters = body_parameters -> next ));
30112999 } else {
30123000 object_init (& z_body_parameter_list );
@@ -3193,7 +3181,8 @@ PHP_FUNCTION(imap_fetch_overview)
31933181 "udate" , strlen ("udate" ),
31943182 mail_longdate (elt )
31953183 );
3196- php_imap_list_add_object (return_value , & myoverview );
3184+
3185+ zend_hash_next_index_insert_new (Z_ARR_P (return_value ), & myoverview );
31973186 }
31983187 }
31993188 }
@@ -4246,7 +4235,7 @@ static zend_string* _php_imap_parse_address (ADDRESS *address_list, zval *paddre
42464235
42474236 fulladdress = _php_rfc822_write_address (addresstmp );
42484237
4249- php_imap_construct_list_of_addresses (paddress , address_list );
4238+ php_imap_construct_list_of_addresses (Z_ARR_P ( paddress ) , address_list );
42504239 return fulladdress ;
42514240}
42524241/* }}} */
@@ -4442,7 +4431,7 @@ void _php_imap_add_body(zval *arg, const BODY *body)
44424431 zval z_content_part ;
44434432 object_init (& z_content_part );
44444433 _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 );
44464435 }
44474436 php_imap_hash_add_object (arg , "parts" , & z_content_part_list );
44484437 }
@@ -4455,7 +4444,7 @@ void _php_imap_add_body(zval *arg, const BODY *body)
44554444 array_init (& message_list );
44564445 object_init (& message );
44574446 _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 );
44594448 php_imap_hash_add_object (arg , "parts" , & message_list );
44604449 }
44614450}
0 commit comments