@@ -429,10 +429,6 @@ static zend_function_entry php_phongo_server_me[] = {
429
429
430
430
431
431
/* {{{ Other functions */
432
- zend_object_handlers * php_phongo_handlers_server () /* {{{ */
433
- {
434
- return & php_phongo_handler_server ;
435
- } /* }}} */
436
432
static int php_phongo_server_compare_objects (zval * o1 , zval * o2 TSRMLS_DC ) /* {{{ */
437
433
{
438
434
php_phongo_server_t * intern1 ;
@@ -461,9 +457,6 @@ static void php_phongo_server_free_object(void *object TSRMLS_DC) /* {{{ */
461
457
462
458
mongoc_client_destroy (intern -> client );
463
459
464
- if (intern -> host ) {
465
- //efree(intern->host);
466
- }
467
460
zend_object_std_dtor (& intern -> std TSRMLS_CC );
468
461
469
462
efree (intern );
@@ -472,16 +465,15 @@ static void php_phongo_server_free_object(void *object TSRMLS_DC) /* {{{ */
472
465
zend_object_value php_phongo_server_create_object (zend_class_entry * class_type TSRMLS_DC ) /* {{{ */
473
466
{
474
467
zend_object_value retval ;
475
- php_phongo_server_t * intern ;
468
+ php_phongo_server_t * intern = NULL ;
476
469
477
- intern = (php_phongo_server_t * )emalloc (sizeof (php_phongo_server_t ));
478
- memset (intern , 0 , sizeof (php_phongo_server_t ));
470
+ intern = (php_phongo_server_t * )ecalloc (1 , sizeof * intern );
479
471
480
472
zend_object_std_init (& intern -> std , class_type TSRMLS_CC );
481
473
object_properties_init (& intern -> std , class_type );
482
474
483
475
retval .handle = zend_objects_store_put (intern , (zend_objects_store_dtor_t ) zend_objects_destroy_object , php_phongo_server_free_object , NULL TSRMLS_CC );
484
- retval .handlers = php_phongo_handlers_server () ;
476
+ retval .handlers = & php_phongo_handler_server ;
485
477
486
478
return retval ;
487
479
} /* }}} */
@@ -490,17 +482,17 @@ zend_object_value php_phongo_server_create_object(zend_class_entry *class_type T
490
482
/* {{{ PHP_MINIT_FUNCTION */
491
483
PHP_MINIT_FUNCTION (Server )
492
484
{
493
- (void )type ; /* We don't care if we are loaded via dl() or extension= */
485
+ (void )type ;( void ) module_number ;
494
486
zend_class_entry ce ;
495
487
496
488
INIT_NS_CLASS_ENTRY (ce , "MongoDB\\Driver" , "Server" , php_phongo_server_me );
497
- ce .create_object = php_phongo_server_create_object ;
498
489
php_phongo_server_ce = zend_register_internal_class (& ce TSRMLS_CC );
490
+ php_phongo_server_ce -> create_object = php_phongo_server_create_object ;
499
491
php_phongo_server_ce -> ce_flags |= ZEND_ACC_FINAL_CLASS ;
500
492
501
-
502
493
memcpy (& php_phongo_handler_server , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
503
494
php_phongo_handler_server .compare_objects = php_phongo_server_compare_objects ;
495
+
504
496
zend_declare_class_constant_long (php_phongo_server_ce , ZEND_STRL ("TYPE_MONGOS" ), 0x01 TSRMLS_CC );
505
497
zend_declare_class_constant_long (php_phongo_server_ce , ZEND_STRL ("TYPE_STANDALONE" ), 0x02 TSRMLS_CC );
506
498
zend_declare_class_constant_long (php_phongo_server_ce , ZEND_STRL ("TYPE_ARBITER" ), 0x03 TSRMLS_CC );
0 commit comments