X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fbuffer-usage.c;h=e19a875c9b96ccd1e3f3d395f03787dc03d8b32e;hp=3d0026081e1f98e3450f4b0f843b2ca213f5bb17;hb=9b63a4aa352c184984395c097f86d5e54c295012;hpb=3647288fe42b25340f905046f3bd9aef21e12aaa diff --git a/src/common/buffer-usage.c b/src/common/buffer-usage.c index 3d0026081..e19a875c9 100644 --- a/src/common/buffer-usage.c +++ b/src/common/buffer-usage.c @@ -88,6 +88,10 @@ bool lttng_condition_buffer_usage_validate( ERR("Invalid buffer condition: a threshold must be set."); goto end; } + if (!usage->domain.set) { + ERR("Invalid buffer usage condition: a domain must be set."); + goto end; + } valid = true; end: @@ -194,36 +198,24 @@ bool lttng_condition_buffer_usage_is_equal(const struct lttng_condition *_a, } } - if ((a->session_name && !b->session_name) || - (!a->session_name && b->session_name)) { + /* Condition is not valid if this is not true. */ + assert(a->session_name); + assert(b->session_name); + if (strcmp(a->session_name, b->session_name)) { goto end; } - if (a->channel_name && b->channel_name) { - if (strcmp(a->channel_name, b->channel_name)) { - goto end; - } - } if ((a->channel_name && !b->channel_name) || - (!a->channel_name && b->channel_name)) { + assert(a->channel_name); + assert(b->channel_name); + if (strcmp(a->channel_name, b->channel_name)) { goto end; } - if (a->channel_name && b->channel_name) { - if (strcmp(a->channel_name, b->channel_name)) { - goto end; - } - } - - if ((a->domain.set && !b->domain.set) || - (!a->domain.set && b->domain.set)) { + assert(a->domain.set); + assert(b->domain.set); + if (a->domain.type != b->domain.type) { goto end; } - - if (a->domain.set && b->domain.set) { - if (a->domain.type != b->domain.type) { - goto end; - } - } is_equal = true; end: return is_equal; @@ -747,7 +739,7 @@ end: static int lttng_evaluation_buffer_usage_serialize( - struct lttng_evaluation *evaluation, + const struct lttng_evaluation *evaluation, struct lttng_dynamic_buffer *buf) { struct lttng_evaluation_buffer_usage *usage;