/*
- * Copyright (C) 2018 - Francis Deslauriers <francis.deslauriers@efficios.com>
+ * Copyright (C) 2018 Francis Deslauriers <francis.deslauriers@efficios.com>
*
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License, version 2 only, as
- * published by the Free Software Foundation.
+ * SPDX-License-Identifier: GPL-2.0-only
*
- * This program is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
- * more details.
- *
- * You should have received a copy of the GNU General Public License along with
- * this program; if not, write to the Free Software Foundation, Inc., 51
- * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include <stdbool.h>
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 ustctl_field *first,
+ size_t nr_first,
+ const struct ustctl_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_ustctl_field(&first[i], &second[i])) {
+ goto no_match;
+ }
+ }
+
+ return true;
+
+no_match:
+ return false;
+}