Skip to content

Commit c6c50d9

Browse files
committed
apply code review feedback and remove redundant NULL checks
1 parent 8abf1eb commit c6c50d9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

agent/php_user_instrument_wraprec_hashmap.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -343,19 +343,18 @@ static void nr_scope_hashmap_destroy_internal(nr_scope_hashmap_t** hashmap_ptr)
343343
nr_func_hashmap_t* global_funcs_ht = NULL;
344344
nr_scope_hashmap_t* scope_ht = NULL;
345345

346+
/* This function expects full_name and full_name_len to be validated with
347+
* nr_php_user_instrument_is_name_valid() before being passed in.
348+
* Specifically, it requires that:
349+
* - full_name_len be greater than 0
350+
* - full_name must not be NULL and must not end with `:` (colon) . */
351+
346352
static void nr_php_user_instrument_wraprec_hashmap_name2keys(
347353
nr_func_hashmap_key_t* func,
348354
nr_scope_hashmap_key_t* scope,
349355
const char* full_name,
350356
int full_name_len) {
351357

352-
if (nrunlikely(NULL == full_name)) {
353-
return;
354-
}
355-
if (nrunlikely(full_name_len <= 0)) {
356-
return;
357-
}
358-
359358
func->name = full_name;
360359
func->name_len = full_name_len;
361360
func->name_hash = 0;

0 commit comments

Comments
 (0)