Skip to content

Commit 767d7cb

Browse files
committed
WS
1 parent 2db64d8 commit 767d7cb

File tree

2 files changed

+116
-116
lines changed

2 files changed

+116
-116
lines changed

ext/module_class.c

Lines changed: 114 additions & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ zend_object_handlers module_object_handlers;
2828

2929
void module_free(void *object TSRMLS_DC) /* {{{ */
3030
{
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);
3434
}
3535
/* }}} */
3636

@@ -72,7 +72,7 @@ PHP_METHOD(PHPGo__Module, __fun)
7272

7373
if (zend_hash_find(&intern->module->exports, fname, strlen(fname)+1, (void**)&pexport) != SUCCESS) {
7474
php_error(E_ERROR, "Internal error: couldn't find export named `%s`", fname);
75-
goto out;
75+
goto out;
7676
}
7777

7878
export = *pexport;
@@ -90,58 +90,58 @@ PHP_METHOD(PHPGo__Module, __fun)
9090
export->num_ins == 1 ? "" : "s",
9191
argc
9292
);
93-
goto out;
93+
goto out;
9494
}
9595

9696
ins = ecalloc(export->num_ins, sizeof(*ins));
9797

9898
for (i = 0; i < export->num_ins; i++) {
9999
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);
145145
}
146146
}
147147

@@ -153,59 +153,59 @@ PHP_METHOD(PHPGo__Module, __fun)
153153

154154
for (i = 0; i < export->num_outs; i++) {
155155
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);
196196
}
197197
}
198198

199199
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+
}
209209
}
210210

211211
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)
230230

231231
void phpgo_module_destroy_class(zend_class_entry *ce)
232232
{
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+
}
241241
}
242242

243243
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)
250250
HashPosition pos;
251251
php_export **pexport;
252252
int fidx = -1;
253-
zend_module_entry *prev_module;
253+
zend_module_entry *prev_module;
254254

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;
258258

259259
spprintf(&class_name, 0, "PHPGo\\Module\\%s_%x_%x", module->name, PHPGO_G(load_counter)++, rand());
260260

@@ -278,10 +278,10 @@ void phpgo_module_new_instance(zval *ret, phpgo_module *module TSRMLS_DC)
278278
intern = (module_intern*)zend_object_store_get_object(ret TSRMLS_CC);
279279
intern->module = module;
280280

281-
efree(class_name);
282-
efree(module_fe);
281+
efree(class_name);
282+
efree(module_fe);
283283

284-
EG(current_module) = prev_module;
284+
EG(current_module) = prev_module;
285285
}
286286

287287
void phpgo_module_class_init()

ext/phpgo.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,9 +99,9 @@ PHP_RINIT_FUNCTION(phpgo)
9999

100100
static int clean_module_class(void *pDest TSRMLS_DC) /* {{{ */
101101
{
102-
zend_class_entry *ce = *(zend_class_entry**)pDest;
102+
zend_class_entry *ce = *(zend_class_entry**)pDest;
103103
if (ce->type == ZEND_INTERNAL_CLASS && ce->info.internal.module->module_number == phpgo_module_entry.module_number) {
104-
phpgo_module_destroy_class(ce);
104+
phpgo_module_destroy_class(ce);
105105
return ZEND_HASH_APPLY_REMOVE;
106106
} else {
107107
return ZEND_HASH_APPLY_KEEP;

0 commit comments

Comments
 (0)