Skip to content

Commit

Permalink
simplify anonymoous class check with rb_mod_name
Browse files Browse the repository at this point in the history
  • Loading branch information
anmarchenko committed Jul 15, 2024
1 parent a020a39 commit d62aef2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ext/datadog_cov/datadog_cov.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,9 @@ static void on_newobj_event(VALUE tracepoint_data, void *data)
}
// Skip anonymous classes starting with "#<Class".
// it allows us to skip the source location lookup that will always fail
const char *name = rb_obj_classname(new_object);
const unsigned long klass_name_len = strlen(name);
if (klass_name_len >= 2 && name[0] == '#' && name[1] == '<')
//
// rb_mod_name returns nil for anonymous classes
if (rb_mod_name(klass) == Qnil)
{
return;
}
Expand Down

0 comments on commit d62aef2

Please sign in to comment.