@@ -76,10 +76,9 @@ static bool phongo_binary_init_from_hash(phongo_binary_t* intern, HashTable* pro
7676
7777static HashTable * phongo_binary_get_properties_hash (zend_object * object , bool is_temp , bool is_debug )
7878{
79- phongo_binary_t * intern ;
80- HashTable * props ;
79+ PHONGO_INTERN_FROM_Z_OBJ (binary , object );
8180
82- intern = Z_OBJ_BINARY ( object ) ;
81+ HashTable * props ;
8382
8483 PHONGO_GET_PROPERTY_HASH_INIT_PROPS (is_temp , intern , props , 2 );
8584
@@ -108,12 +107,10 @@ static HashTable* phongo_binary_get_properties_hash(zend_object* object, bool is
108107/* Construct a new BSON binary type */
109108static PHP_METHOD (MongoDB_BSON_Binary , __construct )
110109{
111- phongo_binary_t * intern ;
112- char * data ;
113- size_t data_len ;
114- zend_long type = BSON_SUBTYPE_BINARY ;
115-
116- intern = Z_BINARY_OBJ_P (getThis ());
110+ PHONGO_INTERN_FROM_THIS (binary );
111+ char * data ;
112+ size_t data_len ;
113+ zend_long type = BSON_SUBTYPE_BINARY ;
117114
118115 PHONGO_PARSE_PARAMETERS_START (1 , 2 )
119116 Z_PARAM_STRING (data , data_len )
@@ -126,39 +123,32 @@ static PHP_METHOD(MongoDB_BSON_Binary, __construct)
126123
127124static PHP_METHOD (MongoDB_BSON_Binary , __set_state )
128125{
129- phongo_binary_t * intern ;
130- HashTable * props ;
131- zval * array ;
126+ HashTable * props ;
127+ zval * array ;
132128
133129 PHONGO_PARSE_PARAMETERS_START (1 , 1 )
134130 Z_PARAM_ARRAY (array )
135131 PHONGO_PARSE_PARAMETERS_END ();
136132
137- object_init_ex (return_value , phongo_binary_ce );
138-
139- intern = Z_BINARY_OBJ_P (return_value );
140- props = Z_ARRVAL_P (array );
133+ PHONGO_INTERN_INIT_EX (binary , return_value );
134+ props = Z_ARRVAL_P (array );
141135
142136 phongo_binary_init_from_hash (intern , props );
143137}
144138
145139/* Return the Binary's data string. */
146140static PHP_METHOD (MongoDB_BSON_Binary , __toString )
147141{
148- phongo_binary_t * intern ;
142+ PHONGO_INTERN_FROM_THIS ( binary ) ;
149143
150144 PHONGO_PARSE_PARAMETERS_NONE ();
151145
152- intern = Z_BINARY_OBJ_P (getThis ());
153-
154146 RETURN_STRINGL (intern -> data , intern -> data_len );
155147}
156148
157149static PHP_METHOD (MongoDB_BSON_Binary , getData )
158150{
159- phongo_binary_t * intern ;
160-
161- intern = Z_BINARY_OBJ_P (getThis ());
151+ PHONGO_INTERN_FROM_THIS (binary );
162152
163153 PHONGO_PARSE_PARAMETERS_NONE ();
164154
@@ -167,9 +157,7 @@ static PHP_METHOD(MongoDB_BSON_Binary, getData)
167157
168158static PHP_METHOD (MongoDB_BSON_Binary , getType )
169159{
170- phongo_binary_t * intern ;
171-
172- intern = Z_BINARY_OBJ_P (getThis ());
160+ PHONGO_INTERN_FROM_THIS (binary );
173161
174162 PHONGO_PARSE_PARAMETERS_NONE ();
175163
@@ -178,14 +166,12 @@ static PHP_METHOD(MongoDB_BSON_Binary, getType)
178166
179167static PHP_METHOD (MongoDB_BSON_Binary , jsonSerialize )
180168{
181- phongo_binary_t * intern ;
182- char type [3 ];
183- int type_len ;
169+ PHONGO_INTERN_FROM_THIS ( binary ) ;
170+ char type [3 ];
171+ int type_len ;
184172
185173 PHONGO_PARSE_PARAMETERS_NONE ();
186174
187- intern = Z_BINARY_OBJ_P (getThis ());
188-
189175 array_init_size (return_value , 2 );
190176
191177 {
@@ -221,7 +207,7 @@ static zend_object_handlers phongo_handler_binary;
221207
222208static void phongo_binary_free_object (zend_object * object )
223209{
224- phongo_binary_t * intern = Z_OBJ_BINARY ( object );
210+ PHONGO_INTERN_FROM_Z_OBJ ( binary , object );
225211
226212 zend_object_std_dtor (& intern -> std );
227213
@@ -237,10 +223,7 @@ static void phongo_binary_free_object(zend_object* object)
237223
238224static zend_object * phongo_binary_create_object (zend_class_entry * class_type )
239225{
240- phongo_binary_t * intern = zend_object_alloc (sizeof (phongo_binary_t ), class_type );
241-
242- zend_object_std_init (& intern -> std , class_type );
243- object_properties_init (& intern -> std , class_type );
226+ PHONGO_INTERN_OBJECT_ALLOC (binary , class_type );
244227
245228 intern -> std .handlers = & phongo_handler_binary ;
246229
@@ -249,11 +232,11 @@ static zend_object* phongo_binary_create_object(zend_class_entry* class_type)
249232
250233static zend_object * phongo_binary_clone_object (zend_object * object )
251234{
252- phongo_binary_t * intern ;
235+ PHONGO_INTERN_FROM_Z_OBJ (binary , object );
236+
253237 phongo_binary_t * new_intern ;
254238 zend_object * new_object ;
255239
256- intern = Z_OBJ_BINARY (object );
257240 new_object = phongo_binary_create_object (object -> ce );
258241
259242 new_intern = Z_OBJ_BINARY (new_object );
@@ -291,7 +274,7 @@ static HashTable* phongo_binary_get_debug_info(zend_object* object, int* is_temp
291274 * is_temp = 1 ;
292275 HashTable * props = phongo_binary_get_properties_hash (object , true, true);
293276
294- phongo_binary_t * intern = Z_OBJ_BINARY ( object );
277+ PHONGO_INTERN_FROM_Z_OBJ ( binary , object );
295278
296279 if (intern -> type == BSON_SUBTYPE_VECTOR ) {
297280 zval vector ;
@@ -510,7 +493,7 @@ static PHP_METHOD(MongoDB_BSON_Binary, fromVector)
510493 zend_object * type ;
511494
512495 object_init_ex (return_value , phongo_binary_ce );
513- phongo_binary_t * intern = Z_BINARY_OBJ_P ( return_value );
496+ PHONGO_INTERN_FROM_ZVAL ( binary , return_value );
514497
515498 PHONGO_PARSE_PARAMETERS_START (2 , 2 )
516499 Z_PARAM_ARRAY_HT (vector )
@@ -557,9 +540,9 @@ static phongo_bson_vector_type_t phongo_binary_get_vector_type(const phongo_bina
557540
558541static PHP_METHOD (MongoDB_BSON_Binary , getVectorType )
559542{
560- PHONGO_PARSE_PARAMETERS_NONE ( );
543+ PHONGO_INTERN_FROM_THIS ( binary );
561544
562- phongo_binary_t * intern = Z_BINARY_OBJ_P ( getThis () );
545+ PHONGO_PARSE_PARAMETERS_NONE ( );
563546
564547 if (intern -> type != BSON_SUBTYPE_VECTOR ) {
565548 phongo_throw_exception (PHONGO_ERROR_LOGIC , "Expected Binary of type vector (%" PRId8 ") but it is %" PHONGO_LONG_FORMAT , BSON_SUBTYPE_VECTOR , intern -> type );
@@ -664,9 +647,9 @@ static void phongo_binary_get_vector_as_array(const phongo_binary_t* intern, zva
664647
665648static PHP_METHOD (MongoDB_BSON_Binary , toArray )
666649{
667- PHONGO_PARSE_PARAMETERS_NONE ( );
650+ PHONGO_INTERN_FROM_THIS ( binary );
668651
669- phongo_binary_t * intern = Z_BINARY_OBJ_P ( getThis () );
652+ PHONGO_PARSE_PARAMETERS_NONE ( );
670653
671654 if (intern -> type != BSON_SUBTYPE_VECTOR ) {
672655 phongo_throw_exception (PHONGO_ERROR_LOGIC , "Expected Binary of type vector (%" PRId8 ") but it is %" PHONGO_LONG_FORMAT , BSON_SUBTYPE_VECTOR , intern -> type );
0 commit comments