X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-field-utils.c;h=a8f3da2ba7a96c088d54f373962e56311033697b;hp=a89fade5ec93254c237a73a0d45e991e7a5e947e;hb=28dc0326d832142a7b5fe5e31d4ebb5d8c5d745a;hpb=17cb7bac747514bcf1bd95f0a3d20b59e02777e6 diff --git a/src/bin/lttng-sessiond/ust-field-utils.c b/src/bin/lttng-sessiond/ust-field-utils.c index a89fade5e..a8f3da2ba 100644 --- a/src/bin/lttng-sessiond/ust-field-utils.c +++ b/src/bin/lttng-sessiond/ust-field-utils.c @@ -338,3 +338,33 @@ int match_lttng_ust_ctl_field(const struct lttng_ust_ctl_field *first, no_match: return false; } + +/* + * Compare two arrays of UST fields. + * Return true if both arrays have identical field definitions, false otherwise. + */ +bool match_lttng_ust_ctl_field_array(const struct lttng_ust_ctl_field *first, + size_t nr_first, + const struct lttng_ust_ctl_field *second, + size_t nr_second) +{ + size_t i; + const size_t nr_fields = nr_first; + + /* Compare the array lengths. */ + if (nr_first != nr_second) { + goto no_match; + } + + /* Compare each field individually. */ + for (i = 0; i < nr_fields; i++) { + if (!match_lttng_ust_ctl_field(&first[i], &second[i])) { + goto no_match; + } + } + + return true; + +no_match: + return false; +}