Skip to content

Commit 0c09c45

Browse files
committed
Only compute callback name in error cases
Mostly the callback name is only used to report an error. Try to avoid calculating it if no error occurred.
1 parent 12f81fa commit 0c09c45

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

ibase_events.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,6 @@ PHP_FUNCTION(ibase_set_event_handler)
264264
* link resource id (int) as arguments. The value returned from the function is
265265
* used to determine if the event handler should remain set.
266266
*/
267-
zend_string *cb_name;
268267
zval *args, *cb_arg;
269268
ibase_db_link *ib_link;
270269
ibase_event *event;
@@ -318,12 +317,12 @@ PHP_FUNCTION(ibase_set_event_handler)
318317
}
319318

320319
/* get the callback */
321-
if (!zend_is_callable(cb_arg, 0, &cb_name)) {
320+
if (!zend_is_callable(cb_arg, 0, NULL)) {
321+
zend_string *cb_name = zend_get_callable_name(cb_arg);
322322
_php_ibase_module_error("Callback argument %s is not a callable function", ZSTR_VAL(cb_name));
323323
zend_string_release(cb_name);
324324
RETURN_FALSE;
325325
}
326-
zend_string_release(cb_name);
327326

328327
/* allocate the event resource */
329328
event = (ibase_event *) safe_emalloc(sizeof(ibase_event), 1, 0);

0 commit comments

Comments
 (0)