Skip to content

Commit 13e98cd

Browse files
committed
don't allocate that, static inline this
1 parent c10796e commit 13e98cd

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

phpdbg_prompt.c

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -917,25 +917,27 @@ static PHPDBG_COMMAND(list) /* {{{ */
917917
return SUCCESS;
918918
} /* }}} */
919919

920-
int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */
920+
static inline int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */
921921
{
922922
phpdbg_input_t *function = input->argv[0];
923923

924924
if (zend_hash_exists(
925925
&PHPDBG_G(registered), function->string, function->length+1)) {
926926

927927
zval fname, *fretval;
928-
zend_fcall_info *fci = ecalloc(1, sizeof(zend_fcall_info));
928+
zend_fcall_info fci;
929929

930930
ZVAL_STRINGL(&fname, function->string, function->length, 1);
931931

932-
fci->size = sizeof(zend_fcall_info);
933-
fci->function_table = &PHPDBG_G(registered);
934-
fci->function_name = &fname;
935-
fci->symbol_table = EG(active_symbol_table);
936-
fci->object_ptr = NULL;
937-
fci->retval_ptr_ptr = &fretval;
938-
fci->no_separation = 1;
932+
memset(&fci, 0, sizeof(zend_fcall_info));
933+
934+
fci.size = sizeof(zend_fcall_info);
935+
fci.function_table = &PHPDBG_G(registered);
936+
fci.function_name = &fname;
937+
fci.symbol_table = EG(active_symbol_table);
938+
fci.object_ptr = NULL;
939+
fci.retval_ptr_ptr = &fretval;
940+
fci.no_separation = 1;
939941

940942
if (input->argc > 1) {
941943
int param;
@@ -954,17 +956,17 @@ int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */
954956
param, param+1, input->argv[param+1]->string);
955957
}
956958

957-
zend_fcall_info_args(fci, &params TSRMLS_CC);
959+
zend_fcall_info_args(&fci, &params TSRMLS_CC);
958960
} else {
959-
fci->params = NULL;
960-
fci->param_count = 0;
961+
fci.params = NULL;
962+
fci.param_count = 0;
961963
}
962964

963965
phpdbg_debug(
964966
"created %d params from %d argvuments",
965-
fci->param_count, input->argc);
967+
fci.param_count, input->argc);
966968

967-
zend_call_function(fci, NULL TSRMLS_CC);
969+
zend_call_function(&fci, NULL TSRMLS_CC);
968970

969971
if (fretval) {
970972
zend_print_zval_r(
@@ -973,12 +975,6 @@ int phpdbg_call_register(phpdbg_input_t *input TSRMLS_DC) /* {{{ */
973975
}
974976

975977
zval_dtor(&fname);
976-
977-
if (fci->params) {
978-
efree(fci->params);
979-
}
980-
981-
efree(fci);
982978

983979
return SUCCESS;
984980
}

0 commit comments

Comments
 (0)