Skip to content

Commit b457827

Browse files
committed
explain passing -1 as namestrlen argument of nr_php_add_custom_tracer_named
1 parent 75e2253 commit b457827

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

agent/tests/test_user_instrument.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,10 @@ static void test_add_custom_tracer_named() {
155155
wr = nr_php_add_custom_tracer_named("function_name", 0);
156156
tlib_pass_if_null("add_custom_tracer_named with length == 0", wr);
157157

158+
// nr_php_add_custom_tracer_named's second argument is of size_t type,
159+
// which is **unsigned**!!! However, under the hood, it calls a function
160+
// that converts it to an int! So this is testing that no unwanted
161+
// side effects will happen when this silent type conversion takes place.
158162
wr = nr_php_add_custom_tracer_named("function_name", -1);
159163
tlib_pass_if_null("add_custom_tracer_named with length < 0", wr);
160164

0 commit comments

Comments
 (0)