Fix: assume that conditions are valid before being compared
[lttng-tools.git] / src / common / session-consumed-size.c
index f29176f8df91e08ca166d74a04f1ff0f12f2ae6c..e60437d13d3177294d714965dace7212c62b498d 100644 (file)
@@ -136,8 +136,9 @@ bool lttng_condition_session_consumed_size_is_equal(const struct lttng_condition
                }
        }
 
-       if ((a->session_name && !b->session_name) ||
-                       (!a->session_name && b->session_name)) {
+       assert(a->session_name);
+       assert(b->session_name);
+       if (strcmp(a->session_name, b->session_name)) {
                goto end;
        }
 
@@ -258,7 +259,6 @@ error:
 
 static
 struct lttng_evaluation *create_evaluation_from_buffer(
-               enum lttng_condition_type type,
                const struct lttng_buffer_view *view)
 {
        const struct lttng_evaluation_session_consumed_size_comm *comm =
@@ -269,7 +269,7 @@ struct lttng_evaluation *create_evaluation_from_buffer(
                goto end;
        }
 
-       evaluation = lttng_evaluation_session_consumed_size_create(type,
+       evaluation = lttng_evaluation_session_consumed_size_create(
                        comm->session_consumed);
 end:
        return evaluation;
@@ -288,8 +288,7 @@ ssize_t lttng_evaluation_session_consumed_size_create_from_buffer(
                goto error;
        }
 
-       evaluation = create_evaluation_from_buffer(
-                       LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE, view);
+       evaluation = create_evaluation_from_buffer(view);
        if (!evaluation) {
                ret = -1;
                goto error;
@@ -428,7 +427,7 @@ void lttng_evaluation_session_consumed_size_destroy(
 
 LTTNG_HIDDEN
 struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(
-               enum lttng_condition_type type, uint64_t consumed)
+               uint64_t consumed)
 {
        struct lttng_evaluation_session_consumed_size *consumed_eval;
 
@@ -437,7 +436,7 @@ struct lttng_evaluation *lttng_evaluation_session_consumed_size_create(
                goto end;
        }
 
-       consumed_eval->parent.type = type;
+       consumed_eval->parent.type = LTTNG_CONDITION_TYPE_SESSION_CONSUMED_SIZE;
        consumed_eval->session_consumed = consumed;
        consumed_eval->parent.serialize = lttng_evaluation_session_consumed_size_serialize;
        consumed_eval->parent.destroy = lttng_evaluation_session_consumed_size_destroy;
This page took 0.024349 seconds and 4 git commands to generate.