X-Git-Url: https://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fust-field-utils.cpp;h=a8f3da2ba7a96c088d54f373962e56311033697b;hb=fb2772932d3207bd9d340f34f41d822d9c0ff0a9;hp=a89fade5ec93254c237a73a0d45e991e7a5e947e;hpb=ce9dbd47eea9fe023691518ef46b58c03b89c236;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..a8f3da2ba 100644 --- a/src/bin/lttng-sessiond/ust-field-utils.cpp +++ b/src/bin/lttng-sessiond/ust-field-utils.cpp @@ -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; +}