From f3164c6d31bcd5a4ea17d20d6c4d43983ed3018d Mon Sep 17 00:00:00 2001 From: Brian Duranleau Date: Tue, 11 Jun 2024 15:25:52 -0500 Subject: [PATCH] chore: re-use existing function logic --- agent/php_wrapper.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/agent/php_wrapper.c b/agent/php_wrapper.c index 965b171df..6631c06d2 100644 --- a/agent/php_wrapper.c +++ b/agent/php_wrapper.c @@ -79,17 +79,18 @@ nruserfn_t* nr_php_wrap_user_function_before_after_clean_extra( nrspecialfn_t before_callback, nrspecialfn_t after_callback, nrspecialfn_t clean_callback, - const char *extra) { - - nruserfn_t* wraprec = nr_php_add_custom_tracer_named(name, namelen); + const char* extra) { + nruserfn_t* wraprec = nr_php_wrap_user_function_before_after_clean( + name, namelen, before_callback, after_callback, clean_callback); + + if (nrunlikely(NULL == wraprec)) { + nrl_warning(NRL_INSTRUMENT, "%s: unable to wrap '%s'", __func__, + NRSAFESTR(name)); + return wraprec; + } wraprec->extra = extra; - nr_php_wraprec_add_before_after_clean_callbacks(name, namelen, wraprec, - before_callback, - after_callback, - clean_callback); - return wraprec; }