Skip to content

Commit 8ddc8af

Browse files
style(agent): drupal code formatting (#1029)
1 parent 11b67fa commit 8ddc8af

File tree

4 files changed

+44
-43
lines changed

4 files changed

+44
-43
lines changed

agent/fw_drupal.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ static void nr_drupal_wrap_hook_within_module_invoke_all(
484484
*/
485485
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
486486
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
487-
zval* curr_hook
488-
= (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks));
487+
zval* curr_hook = (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks));
489488
if (!nr_php_is_zval_non_empty_string(curr_hook)) {
490489
nrl_verbosedebug(NRL_FRAMEWORK,
491490
"%s: cannot extract hook name from global stack",

agent/fw_drupal8.c

+30-31
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ NR_PHP_WRAPPER(nr_drupal_exception) {
6666

6767
if (NR_SUCCESS
6868
!= nr_php_error_record_exception(NRPRG(txn), exception, priority, true,
69-
NULL,
70-
&NRPRG(exception_filters))) {
69+
NULL, &NRPRG(exception_filters))) {
7170
nrl_verbosedebug(NRL_TXN, "Drupal: unable to record exception");
7271
}
7372

@@ -134,12 +133,12 @@ static void nr_drupal8_add_method_callback(const zend_class_entry* ce,
134133
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
135134
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
136135
static void nr_drupal8_add_method_callback_before_after_clean(
137-
const zend_class_entry* ce,
138-
const char* method,
139-
size_t method_len,
140-
nrspecialfn_t before_callback,
141-
nrspecialfn_t after_callback,
142-
nrspecialfn_t clean_callback) {
136+
const zend_class_entry* ce,
137+
const char* method,
138+
size_t method_len,
139+
nrspecialfn_t before_callback,
140+
nrspecialfn_t after_callback,
141+
nrspecialfn_t clean_callback) {
143142
zend_function* function = NULL;
144143

145144
if (NULL == ce) {
@@ -164,13 +163,13 @@ static void nr_drupal8_add_method_callback_before_after_clean(
164163
nr_php_class_entry_name(ce), NRSAFELEN(method_len), method);
165164

166165
nr_php_wrap_user_function_before_after_clean(
167-
class_method, nr_strlen(class_method),
168-
before_callback, after_callback, clean_callback);
166+
class_method, nr_strlen(class_method), before_callback, after_callback,
167+
clean_callback);
169168

170169
nr_free(class_method);
171170
}
172171
}
173-
#endif // OAPI
172+
#endif // OAPI
174173

175174
/*
176175
* Purpose : Check if the given function or method is in the current call
@@ -501,8 +500,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_callback) {
501500

502501
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
503502
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
504-
zval* curr_hook
505-
= (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks));
503+
zval* curr_hook = (zval*)nr_stack_get_top(&NRPRG(drupal_invoke_all_hooks));
506504
if (UNEXPECTED(!nr_php_is_zval_non_empty_string(curr_hook))) {
507505
nrl_verbosedebug(NRL_FRAMEWORK,
508506
"%s: cannot extract hook name from global stack",
@@ -515,7 +513,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_callback) {
515513
nr_drupal_hook_instrument(Z_STRVAL_P(module), Z_STRLEN_P(module),
516514
NRPRG(drupal_invoke_all_hook),
517515
NRPRG(drupal_invoke_all_hook_len) TSRMLS_CC);
518-
#endif // OAPI
516+
#endif // OAPI
519517

520518
leave:
521519
NR_PHP_WRAPPER_CALL;
@@ -536,7 +534,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) {
536534
|| defined OVERWRITE_ZEND_EXECUTE_DATA
537535
char* prev_hook = NULL;
538536
int prev_hook_len;
539-
#endif // not OAPI
537+
#endif // not OAPI
540538

541539
(void)wraprec;
542540

@@ -547,7 +545,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) {
547545
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
548546
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
549547
nr_php_arg_release(&hook);
550-
#endif // OAPI
548+
#endif // OAPI
551549
goto leave;
552550
}
553551

@@ -561,7 +559,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) {
561559
= nr_strndup(Z_STRVAL_P(hook), Z_STRLEN_P(hook));
562560
NRPRG(drupal_invoke_all_hook_len) = Z_STRLEN_P(hook);
563561
NRPRG(check_cufa) = true;
564-
#endif // OAPI
562+
#endif // OAPI
565563
callback = nr_php_arg_get(2, NR_EXECUTE_ORIG_ARGS TSRMLS_CC);
566564

567565
/* This instrumentation will fail if callback has already been wrapped
@@ -581,14 +579,14 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with) {
581579
if (NULL == NRPRG(drupal_invoke_all_hook)) {
582580
NRPRG(check_cufa) = false;
583581
}
584-
#endif // not OAPI
582+
#endif // not OAPI
585583

586-
leave: ;
584+
leave:;
587585
#if ZEND_MODULE_API_NO < ZEND_8_0_X_API_NO \
588586
|| defined OVERWRITE_ZEND_EXECUTE_DATA
589587
/* for OAPI, the _after callback handles this free */
590588
nr_php_arg_release(&hook);
591-
#endif // not OAPI
589+
#endif // not OAPI
592590
}
593591
NR_PHP_WRAPPER_END
594592

@@ -605,7 +603,7 @@ NR_PHP_WRAPPER(nr_drupal94_invoke_all_with_clean) {
605603
nr_drupal_invoke_all_hook_stacks_pop();
606604
}
607605
NR_PHP_WRAPPER_END
608-
#endif // OAPI
606+
#endif // OAPI
609607

610608
/*
611609
* Purpose : Wrap the invoke() method of the module handler instance in use.
@@ -642,10 +640,8 @@ NR_PHP_WRAPPER(nr_drupal8_module_handler) {
642640
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
643641
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
644642
nr_drupal8_add_method_callback_before_after_clean(
645-
ce, NR_PSTR("invokeallwith"),
646-
nr_drupal94_invoke_all_with,
647-
nr_drupal94_invoke_all_with_after,
648-
nr_drupal94_invoke_all_with_clean);
643+
ce, NR_PSTR("invokeallwith"), nr_drupal94_invoke_all_with,
644+
nr_drupal94_invoke_all_with_after, nr_drupal94_invoke_all_with_clean);
649645
#else
650646
nr_drupal8_add_method_callback(ce, NR_PSTR("invokeallwith"),
651647
nr_drupal94_invoke_all_with TSRMLS_CC);
@@ -766,14 +762,16 @@ void nr_drupal8_enable(TSRMLS_D) {
766762
*/
767763
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
768764
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
765+
// clang-format off
769766
nr_php_wrap_user_function_before_after_clean(
770-
NR_PSTR("Symfony\\Component\\HttpKernel\\EventListe"
771-
"ner\\RouterListener::onKernelRequest"),
767+
NR_PSTR("Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest"),
772768
nr_drupal8_name_the_wt_via_symfony, NULL, NULL);
769+
// clang-format on
773770
#else
774-
nr_php_wrap_user_function(NR_PSTR("Symfony\\Component\\HttpKernel\\EventListe"
775-
"ner\\RouterListener::onKernelRequest"),
771+
// clang-format off
772+
nr_php_wrap_user_function(NR_PSTR("Symfony\\Component\\HttpKernel\\EventListener\\RouterListener::onKernelRequest"),
776773
nr_drupal8_name_the_wt_via_symfony TSRMLS_CC);
774+
// clang-format on
777775
#endif
778776

779777
/*
@@ -783,9 +781,10 @@ void nr_drupal8_enable(TSRMLS_D) {
783781
* above, but kicks in for use cases where the RouterListener is not
784782
* involved.
785783
*/
786-
nr_php_wrap_user_function(NR_PSTR("Drupal\\Core\\Controller\\ControllerResolv"
787-
"er::getControllerFromDefinition"),
784+
// clang-format off
785+
nr_php_wrap_user_function(NR_PSTR("Drupal\\Core\\Controller\\ControllerResolver::getControllerFromDefinition"),
788786
nr_drupal8_name_the_wt TSRMLS_CC);
787+
// clang-format on
789788

790789
/*
791790
* ExceptionSubscribers handle Drupal errors and exceptions before

agent/fw_drupal_common.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ nr_status_t module_invoke_all_parse_module_and_hook_from_strings(
177177
nrl_verbosedebug(NRL_FRAMEWORK,
178178
"%s: module len is %d; ; "
179179
"hook='%.*s'; module_hook='%.*s'",
180-
__func__, (int)module_len, NRSAFELEN(hook_len), NRSAFESTR(hook),
181-
NRSAFELEN(module_hook_len), NRSAFESTR(module_hook));
180+
__func__, (int)module_len, NRSAFELEN(hook_len),
181+
NRSAFESTR(hook), NRSAFELEN(module_hook_len),
182+
NRSAFESTR(module_hook));
182183

183184
return NR_FAILURE;
184185
}

agent/fw_drupal_common.h

+10-8
Original file line numberDiff line numberDiff line change
@@ -147,23 +147,25 @@ nr_status_t module_invoke_all_parse_module_and_hook_from_strings(
147147
*/
148148
void nr_drupal_headers_add(zval* arg, bool is_drupal_7 TSRMLS_DC);
149149

150-
151150
#if ZEND_MODULE_API_NO >= ZEND_8_0_X_API_NO \
152151
&& !defined OVERWRITE_ZEND_EXECUTE_DATA
153152
/*
154-
* Purpose: Before an invoke_all style call, adds the hook to that hook states stacks
153+
* Purpose: Before an invoke_all style call, adds the hook to that hook states
154+
* stacks
155155
*
156-
* Params : 1. A zval holding a copy of the hook invoked, to be managed by the hook
157-
* states stacks and freed by nr_drupal_invoke_all_hook_stacks_pop() after the
158-
* invoke_all call completes
156+
* Params : 1. A zval holding a copy of the hook invoked, to be managed by the
157+
* hook states stacks and freed by
158+
* nr_drupal_invoke_all_hook_stacks_pop() after the invoke_all call
159+
* completes
159160
*/
160161
void nr_drupal_invoke_all_hook_stacks_push(zval* hook_copy);
161162

162163
/*
163-
* Purpose: After an invoke_all style call, pops that states stack and conditionally
164-
* pops the hook stack based on the previously popped state
164+
* Purpose: After an invoke_all style call, pops that states stack and
165+
* conditionally pops the hook stack based on the previously
166+
* popped state
165167
*/
166168
void nr_drupal_invoke_all_hook_stacks_pop();
167-
#endif // OAPI
169+
#endif // OAPI
168170

169171
#endif /* FW_DRUPAL_COMMON_HDR */

0 commit comments

Comments
 (0)