}
if (key->exclusion && event->exclusion) {
- /* Both exclusions exist; check count followed by names. */
- if (event->exclusion->count != key->exclusion->count ||
- memcmp(event->exclusion->names, key->exclusion->names,
- event->exclusion->count * LTTNG_SYMBOL_NAME_LEN) != 0) {
+ size_t i;
+
+ /* Check exclusion counts first. */
+ if (event->exclusion->count != key->exclusion->count) {
goto no_match;
}
+
+ /* Compare names individually. */
+ for (i = 0; i < event->exclusion->count; ++i) {
+ size_t j;
+ bool found = false;
+ const char *name_ev =
+ LTTNG_EVENT_EXCLUSION_NAME_AT(
+ event->exclusion, i);
+
+ /*
+ * Compare this exclusion name to all the key's
+ * exclusion names.
+ */
+ for (j = 0; j < key->exclusion->count; ++j) {
+ const char *name_key =
+ LTTNG_EVENT_EXCLUSION_NAME_AT(
+ key->exclusion, j);
+
+ if (!strncmp(name_ev, name_key,
+ LTTNG_SYMBOL_NAME_LEN)) {
+ /* Names match! */
+ found = true;
+ break;
+ }
+ }
+
+ /*
+ * If the current exclusion name was not found amongst
+ * the key's exclusion names, then there's no match.
+ */
+ if (!found) {
+ goto no_match;
+ }
+ }
}
/* Match. */
return 1;