@@ -28,9 +28,9 @@ zend_object_handlers module_object_handlers;
28
28
29
29
void module_free (void * object TSRMLS_DC ) /* {{{ */
30
30
{
31
- module_intern * intern = (module_intern * )object ;
32
- phpgo_module_free (intern -> module );
33
- efree (intern );
31
+ module_intern * intern = (module_intern * )object ;
32
+ phpgo_module_free (intern -> module );
33
+ efree (intern );
34
34
}
35
35
/* }}} */
36
36
@@ -72,7 +72,7 @@ PHP_METHOD(PHPGo__Module, __fun)
72
72
73
73
if (zend_hash_find (& intern -> module -> exports , fname , strlen (fname )+ 1 , (void * * )& pexport ) != SUCCESS ) {
74
74
php_error (E_ERROR , "Internal error: couldn't find export named `%s`" , fname );
75
- goto out ;
75
+ goto out ;
76
76
}
77
77
78
78
export = * pexport ;
@@ -90,58 +90,58 @@ PHP_METHOD(PHPGo__Module, __fun)
90
90
export -> num_ins == 1 ? "" : "s" ,
91
91
argc
92
92
);
93
- goto out ;
93
+ goto out ;
94
94
}
95
95
96
96
ins = ecalloc (export -> num_ins , sizeof (* ins ));
97
97
98
98
for (i = 0 ; i < export -> num_ins ; i ++ ) {
99
99
php_arg_desc * a = & export -> ins [i ];
100
- switch (a -> kind ) {
101
- case PHPGO_KIND_BOOL : {
102
- zend_bool b ;
103
- if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "b" , & b ) != SUCCESS ) {
104
- goto out ;
105
- }
106
- ins [i ].b = b ;
107
- break ;
108
- }
109
- case PHPGO_KIND_INT :
110
- case PHPGO_KIND_INT8 :
111
- case PHPGO_KIND_INT32 :
112
- case PHPGO_KIND_INT64 :
113
- case PHPGO_KIND_UINT :
114
- case PHPGO_KIND_UINT8 :
115
- case PHPGO_KIND_UINT32 :
116
- case PHPGO_KIND_UINT64 : {
117
- long l ;
118
- if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "l" , & l ) != SUCCESS ) {
119
- goto out ;
120
- }
121
- ins [i ].l = l ;
122
- break ;
123
- }
124
- case PHPGO_KIND_FLOAT32 :
125
- case PHPGO_KIND_FLOAT64 : {
126
- double d ;
127
- if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "d" , & d ) != SUCCESS ) {
128
- goto out ;
129
- }
130
- ins [i ].d = d ;
131
- break ;
132
- }
133
- case PHPGO_KIND_STRING : {
134
- char * s ;
135
- int l ;
136
- if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "s" , & s , & l ) != SUCCESS ) {
137
- goto out ;
138
- }
139
- ins [i ].s .s = s ;
140
- ins [i ].s .l = l ;
141
- break ;
142
- }
143
- default :
144
- php_error (E_ERROR , "Interval error: unknown input type `0x%x`" , a -> kind );
100
+ switch (a -> kind ) {
101
+ case PHPGO_KIND_BOOL : {
102
+ zend_bool b ;
103
+ if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "b" , & b ) != SUCCESS ) {
104
+ goto out ;
105
+ }
106
+ ins [i ].b = b ;
107
+ break ;
108
+ }
109
+ case PHPGO_KIND_INT :
110
+ case PHPGO_KIND_INT8 :
111
+ case PHPGO_KIND_INT32 :
112
+ case PHPGO_KIND_INT64 :
113
+ case PHPGO_KIND_UINT :
114
+ case PHPGO_KIND_UINT8 :
115
+ case PHPGO_KIND_UINT32 :
116
+ case PHPGO_KIND_UINT64 : {
117
+ long l ;
118
+ if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "l" , & l ) != SUCCESS ) {
119
+ goto out ;
120
+ }
121
+ ins [i ].l = l ;
122
+ break ;
123
+ }
124
+ case PHPGO_KIND_FLOAT32 :
125
+ case PHPGO_KIND_FLOAT64 : {
126
+ double d ;
127
+ if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "d" , & d ) != SUCCESS ) {
128
+ goto out ;
129
+ }
130
+ ins [i ].d = d ;
131
+ break ;
132
+ }
133
+ case PHPGO_KIND_STRING : {
134
+ char * s ;
135
+ int l ;
136
+ if (zend_parse_parameter (0 , i + 1 TSRMLS_CC , args [i ], "s" , & s , & l ) != SUCCESS ) {
137
+ goto out ;
138
+ }
139
+ ins [i ].s .s = s ;
140
+ ins [i ].s .l = l ;
141
+ break ;
142
+ }
143
+ default :
144
+ php_error (E_ERROR , "Interval error: unknown input type `0x%x`" , a -> kind );
145
145
}
146
146
}
147
147
@@ -153,59 +153,59 @@ PHP_METHOD(PHPGo__Module, __fun)
153
153
154
154
for (i = 0 ; i < export -> num_outs ; i ++ ) {
155
155
php_arg_desc * a = & export -> outs [i ];
156
- switch (a -> kind ) {
157
- case PHPGO_KIND_BOOL :
158
- if (export -> num_outs == 1 ) {
159
- RETVAL_BOOL (outs [i ].b );
160
- } else {
161
- add_next_index_bool (return_value , outs [i ].b );
162
- }
163
- break ;
164
- case PHPGO_KIND_INT :
165
- case PHPGO_KIND_INT8 :
166
- case PHPGO_KIND_INT32 :
167
- case PHPGO_KIND_INT64 :
168
- case PHPGO_KIND_UINT :
169
- case PHPGO_KIND_UINT8 :
170
- case PHPGO_KIND_UINT32 :
171
- case PHPGO_KIND_UINT64 :
172
- if (export -> num_outs == 1 ) {
173
- RETVAL_LONG (outs [i ].l );
174
- } else {
175
- add_next_index_long (return_value , outs [i ].l );
176
- }
177
- break ;
178
- case PHPGO_KIND_FLOAT32 :
179
- case PHPGO_KIND_FLOAT64 :
180
- if (export -> num_outs == 1 ) {
181
- RETVAL_DOUBLE (outs [i ].d );
182
- } else {
183
- add_next_index_double (return_value , outs [i ].d );
184
- }
185
- break ;
186
- case PHPGO_KIND_STRING :
187
- if (export -> num_outs == 1 ) {
188
- RETVAL_STRINGL (outs [i ].s .s , outs [i ].s .l , 1 );
189
- } else {
190
- add_next_index_stringl (return_value , outs [i ].s .s , outs [i ].s .l , 1 );
191
- }
192
- free (outs [i ].s .s );
193
- break ;
194
- default :
195
- php_error (E_ERROR , "Interval error: unknown output type `0x%x`" , a -> kind );
156
+ switch (a -> kind ) {
157
+ case PHPGO_KIND_BOOL :
158
+ if (export -> num_outs == 1 ) {
159
+ RETVAL_BOOL (outs [i ].b );
160
+ } else {
161
+ add_next_index_bool (return_value , outs [i ].b );
162
+ }
163
+ break ;
164
+ case PHPGO_KIND_INT :
165
+ case PHPGO_KIND_INT8 :
166
+ case PHPGO_KIND_INT32 :
167
+ case PHPGO_KIND_INT64 :
168
+ case PHPGO_KIND_UINT :
169
+ case PHPGO_KIND_UINT8 :
170
+ case PHPGO_KIND_UINT32 :
171
+ case PHPGO_KIND_UINT64 :
172
+ if (export -> num_outs == 1 ) {
173
+ RETVAL_LONG (outs [i ].l );
174
+ } else {
175
+ add_next_index_long (return_value , outs [i ].l );
176
+ }
177
+ break ;
178
+ case PHPGO_KIND_FLOAT32 :
179
+ case PHPGO_KIND_FLOAT64 :
180
+ if (export -> num_outs == 1 ) {
181
+ RETVAL_DOUBLE (outs [i ].d );
182
+ } else {
183
+ add_next_index_double (return_value , outs [i ].d );
184
+ }
185
+ break ;
186
+ case PHPGO_KIND_STRING :
187
+ if (export -> num_outs == 1 ) {
188
+ RETVAL_STRINGL (outs [i ].s .s , outs [i ].s .l , 1 );
189
+ } else {
190
+ add_next_index_stringl (return_value , outs [i ].s .s , outs [i ].s .l , 1 );
191
+ }
192
+ free (outs [i ].s .s );
193
+ break ;
194
+ default :
195
+ php_error (E_ERROR , "Interval error: unknown output type `0x%x`" , a -> kind );
196
196
}
197
197
}
198
198
199
199
out :
200
- if (args ) {
201
- efree (args );
202
- }
203
- if (ins ) {
204
- efree (ins );
205
- }
206
- if (outs ) {
207
- free (outs );
208
- }
200
+ if (args ) {
201
+ efree (args );
202
+ }
203
+ if (ins ) {
204
+ efree (ins );
205
+ }
206
+ if (outs ) {
207
+ free (outs );
208
+ }
209
209
}
210
210
211
211
static void phpgo_add_method (zend_function_entry * fe , php_export * export )
@@ -230,14 +230,14 @@ static void phpgo_add_method(zend_function_entry *fe, php_export *export)
230
230
231
231
void phpgo_module_destroy_class (zend_class_entry * ce )
232
232
{
233
- zend_function * f ;
234
- for (zend_hash_internal_pointer_reset (& ce -> function_table );
235
- zend_hash_get_current_data (& ce -> function_table , (void * * )& f ) == SUCCESS ;
236
- zend_hash_move_forward (& ce -> function_table )) {
237
- efree ((void * )(f -> common .arg_info - 1 ));
238
- f -> common .arg_info = NULL ;
239
- f -> common .num_args = 0 ;
240
- }
233
+ zend_function * f ;
234
+ for (zend_hash_internal_pointer_reset (& ce -> function_table );
235
+ zend_hash_get_current_data (& ce -> function_table , (void * * )& f ) == SUCCESS ;
236
+ zend_hash_move_forward (& ce -> function_table )) {
237
+ efree ((void * )(f -> common .arg_info - 1 ));
238
+ f -> common .arg_info = NULL ;
239
+ f -> common .num_args = 0 ;
240
+ }
241
241
}
242
242
243
243
void phpgo_module_new_instance (zval * ret , phpgo_module * module TSRMLS_DC )
@@ -250,11 +250,11 @@ void phpgo_module_new_instance(zval *ret, phpgo_module *module TSRMLS_DC)
250
250
HashPosition pos ;
251
251
php_export * * pexport ;
252
252
int fidx = -1 ;
253
- zend_module_entry * prev_module ;
253
+ zend_module_entry * prev_module ;
254
254
255
- // Zend sets some properties on our classes and methods depending on this
256
- prev_module = EG (current_module );
257
- EG (current_module ) = & phpgo_module_entry ;
255
+ // Zend sets some properties on our classes and methods depending on this
256
+ prev_module = EG (current_module );
257
+ EG (current_module ) = & phpgo_module_entry ;
258
258
259
259
spprintf (& class_name , 0 , "PHPGo\\Module\\%s_%x_%x" , module -> name , PHPGO_G (load_counter )++ , rand ());
260
260
@@ -278,10 +278,10 @@ void phpgo_module_new_instance(zval *ret, phpgo_module *module TSRMLS_DC)
278
278
intern = (module_intern * )zend_object_store_get_object (ret TSRMLS_CC );
279
279
intern -> module = module ;
280
280
281
- efree (class_name );
282
- efree (module_fe );
281
+ efree (class_name );
282
+ efree (module_fe );
283
283
284
- EG (current_module ) = prev_module ;
284
+ EG (current_module ) = prev_module ;
285
285
}
286
286
287
287
void phpgo_module_class_init ()
0 commit comments