X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-field-utils.cpp;h=27d3070d2f453897c1112e4dedb9e173df72937d;hb=0d19be9d7e89fa4ff548592edd6d00a723070ced;hp=a89fade5ec93254c237a73a0d45e991e7a5e947e;hpb=7966af5763c4aaca39df9bbfa9277ff15715c720;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/ust-field-utils.cpp b/src/bin/lttng-sessiond/ust-field-utils.cpp index a89fade5e..27d3070d2 100644 --- a/src/bin/lttng-sessiond/ust-field-utils.cpp +++ b/src/bin/lttng-sessiond/ust-field-utils.cpp @@ -8,7 +8,7 @@ #include #include -#include "ust-field-utils.h" +#include "ust-field-utils.hpp" /* * The lttng_ust_ctl_field is made of a combination of C basic types @@ -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; +}