Skip to content

Commit 4d7c50d

Browse files
committed
review: improve conditional
1 parent aa17d9e commit 4d7c50d

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

agent/fw_drupal8.c

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,6 @@ static bool nr_drupal_hook_attribute_instrument(zval* module_handler) {
709709
NR_PHP_WRAPPER(nr_drupal8_module_handler) {
710710
zend_class_entry* ce = NULL;
711711
zval** retval_ptr = NR_GET_RETURN_VALUE_PTR;
712-
bool hook_attribute_instrumentation = false;
713712

714713
NR_UNUSED_SPECIALFN;
715714
(void)wraprec;
@@ -731,26 +730,23 @@ NR_PHP_WRAPPER(nr_drupal8_module_handler) {
731730

732731
ce = Z_OBJCE_P(*retval_ptr);
733732

734-
hook_attribute_instrumentation
735-
= nr_drupal_hook_attribute_instrument(*retval_ptr);
736-
737-
if (!hook_attribute_instrumentation) {
738-
nr_drupal8_add_method_callback(
739-
ce, NR_PSTR("getimplementations"),
740-
nr_drupal8_post_get_implementations TSRMLS_CC);
741-
nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"),
742-
nr_drupal8_post_implements_hook TSRMLS_CC);
743-
/* Drupal 9.4 introduced a replacement method for getImplentations */
733+
if (nr_drupal_hook_attribute_instrument(*retval_ptr)) {
734+
NR_PHP_WRAPPER_LEAVE;
735+
}
736+
nr_drupal8_add_method_callback(ce, NR_PSTR("getimplementations"),
737+
nr_drupal8_post_get_implementations TSRMLS_CC);
738+
nr_drupal8_add_method_callback(ce, NR_PSTR("implementshook"),
739+
nr_drupal8_post_implements_hook TSRMLS_CC);
740+
/* Drupal 9.4 introduced a replacement method for getImplentations */
744741
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
745742
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
746-
nr_drupal8_add_method_callback_before_after_clean(
747-
ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with,
748-
nr_drupal94_invoke_all_with_after, nr_drupal94_invoke_all_with_clean);
743+
nr_drupal8_add_method_callback_before_after_clean(
744+
ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with,
745+
nr_drupal94_invoke_all_with_after, nr_drupal94_invoke_all_with_clean);
749746
#else
750-
nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"),
751-
nr_drupal94_invoke_all_with TSRMLS_CC);
747+
nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"),
748+
nr_drupal94_invoke_all_with TSRMLS_CC);
752749
#endif
753-
}
754750
}
755751
NR_PHP_WRAPPER_END
756752

0 commit comments

Comments
 (0)