@@ -54,14 +54,14 @@ PHP_METHOD(ReadConcern, __construct)
5454 php_phongo_readconcern_t * intern ;
5555 zend_error_handling error_handling ;
5656 char * level = NULL ;
57- int level_len = 0 ;
57+ phongo_zpp_char_len level_len = 0 ;
5858
5959
60- ( void ) return_value ; ( void ) return_value_ptr ; ( void ) return_value_used ;
60+ SUPPRESS_UNUSED_WARNING ( return_value_ptr ) SUPPRESS_UNUSED_WARNING ( return_value ) SUPPRESS_UNUSED_WARNING ( return_value_used )
6161
6262
6363 zend_replace_error_handling (EH_THROW , phongo_exception_from_phongo_domain (PHONGO_ERROR_INVALID_ARGUMENT ), & error_handling TSRMLS_CC );
64- intern = ( php_phongo_readconcern_t * ) zend_object_store_get_object ( getThis () TSRMLS_CC );
64+ intern = Z_READCONCERN_OBJ_P ( getThis ());
6565
6666 if (zend_parse_parameters (ZEND_NUM_ARGS () TSRMLS_CC , "|s!" , & level , & level_len ) == FAILURE ) {
6767 zend_restore_error_handling (& error_handling TSRMLS_CC );
@@ -84,9 +84,9 @@ PHP_METHOD(ReadConcern, getLevel)
8484{
8585 php_phongo_readconcern_t * intern ;
8686 const char * level ;
87- ( void ) return_value_ptr ; ( void ) return_value_used ;
87+ SUPPRESS_UNUSED_WARNING ( return_value_ptr ) SUPPRESS_UNUSED_WARNING ( return_value_used )
8888
89- intern = ( php_phongo_readconcern_t * ) zend_object_store_get_object ( getThis () TSRMLS_CC );
89+ intern = Z_READCONCERN_OBJ_P ( getThis ());
9090
9191 if (zend_parse_parameters_none () == FAILURE ) {
9292 return ;
@@ -95,7 +95,7 @@ PHP_METHOD(ReadConcern, getLevel)
9595 level = mongoc_read_concern_get_level (intern -> read_concern );
9696
9797 if (level ) {
98- RETURN_STRING (level , 1 );
98+ PHONGO_RETURN_STRING (level );
9999 }
100100
101101 RETURN_NULL ();
@@ -124,37 +124,52 @@ static zend_function_entry php_phongo_readconcern_me[] = {
124124
125125
126126/* {{{ php_phongo_readconcern_t object handlers */
127- static void php_phongo_readconcern_free_object (void * object TSRMLS_DC ) /* {{{ */
127+ static void php_phongo_readconcern_free_object (phongo_free_object_arg * object TSRMLS_DC ) /* {{{ */
128128{
129- php_phongo_readconcern_t * intern = ( php_phongo_readconcern_t * ) object ;
129+ php_phongo_readconcern_t * intern = Z_OBJ_READCONCERN ( object ) ;
130130
131131 zend_object_std_dtor (& intern -> std TSRMLS_CC );
132132
133133 if (intern -> read_concern ) {
134134 mongoc_read_concern_destroy (intern -> read_concern );
135135 }
136+
137+ #if PHP_VERSION_ID < 70000
136138 efree (intern );
139+ #endif
137140} /* }}} */
138141
139- zend_object_value php_phongo_readconcern_create_object (zend_class_entry * class_type TSRMLS_DC ) /* {{{ */
142+ phongo_create_object_retval php_phongo_readconcern_create_object (zend_class_entry * class_type TSRMLS_DC ) /* {{{ */
140143{
141- zend_object_value retval ;
142144 php_phongo_readconcern_t * intern = NULL ;
143145
144- intern = (php_phongo_readconcern_t * ) ecalloc ( 1 , sizeof * intern );
146+ intern = PHONGO_ALLOC_OBJECT_T (php_phongo_readconcern_t , class_type );
145147
146148 zend_object_std_init (& intern -> std , class_type TSRMLS_CC );
147149 object_properties_init (& intern -> std , class_type );
148150
149- retval . handle = zend_objects_store_put ( intern , ( zend_objects_store_dtor_t ) zend_objects_destroy_object , php_phongo_readconcern_free_object , NULL TSRMLS_CC );
150- retval .handlers = & php_phongo_handler_readconcern ;
151+ #if PHP_VERSION_ID >= 70000
152+ intern -> std .handlers = & php_phongo_handler_readconcern ;
151153
152- return retval ;
154+ return & intern -> std ;
155+ #else
156+ {
157+ zend_object_value retval ;
158+ retval .handle = zend_objects_store_put (intern , (zend_objects_store_dtor_t ) zend_objects_destroy_object , php_phongo_readconcern_free_object , NULL TSRMLS_CC );
159+ retval .handlers = & php_phongo_handler_readconcern ;
160+
161+ return retval ;
162+ }
163+ #endif
153164} /* }}} */
154165
155166HashTable * php_phongo_readconcern_get_debug_info (zval * object , int * is_temp TSRMLS_DC ) /* {{{ */
156167{
168+ #if PHP_VERSION_ID >= 70000
169+ zval retval ;
170+ #else
157171 zval retval = zval_used_for_init ;
172+ #endif
158173 const mongoc_read_concern_t * read_concern = phongo_read_concern_from_zval (object TSRMLS_CC );
159174
160175
@@ -178,6 +193,10 @@ PHP_MINIT_FUNCTION(ReadConcern)
178193
179194 memcpy (& php_phongo_handler_readconcern , phongo_get_std_object_handlers (), sizeof (zend_object_handlers ));
180195 php_phongo_handler_readconcern .get_debug_info = php_phongo_readconcern_get_debug_info ;
196+ #if PHP_VERSION_ID >= 70000
197+ php_phongo_handler_readconcern .free_obj = php_phongo_readconcern_free_object ;
198+ php_phongo_handler_readconcern .offset = XtOffsetOf (php_phongo_readconcern_t , std );
199+ #endif
181200
182201 zend_declare_class_constant_stringl (php_phongo_readconcern_ce , ZEND_STRL ("LOCAL" ), ZEND_STRL (MONGOC_READ_CONCERN_LEVEL_LOCAL ) TSRMLS_CC );
183202 zend_declare_class_constant_stringl (php_phongo_readconcern_ce , ZEND_STRL ("MAJORITY" ), ZEND_STRL (MONGOC_READ_CONCERN_LEVEL_MAJORITY ) TSRMLS_CC );
0 commit comments