X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Ftrace-chunk.c;h=ec52e5d2b3e30598216e26bf1f8eea6fd7a2ae9a;hp=313d49375d6ed0e03cec04af05619aa961b545b2;hb=ad8bec244fdbb0e7705fd1865ae71f36f06d2b94;hpb=4b050fdd4674dd33baf805bbffec487bb42bd88d diff --git a/src/common/trace-chunk.c b/src/common/trace-chunk.c index 313d49375..ec52e5d2b 100644 --- a/src/common/trace-chunk.c +++ b/src/common/trace-chunk.c @@ -1828,6 +1828,32 @@ const char *lttng_trace_chunk_command_type_get_name( } } +LTTNG_HIDDEN +bool lttng_trace_chunk_ids_equal(const struct lttng_trace_chunk *chunk_a, + const struct lttng_trace_chunk *chunk_b) +{ + bool equal = false; + + if (!chunk_a || !chunk_b) { + goto end; + } + + if (chunk_a->id.is_set ^ chunk_a->id.is_set) { + /* One id is set and not the other, thus they are not equal. */ + goto end; + } + + if (!chunk_a->id.is_set) { + /* Both ids are unset. */ + equal = true; + } else { + equal = chunk_a->id.value == chunk_b->id.value; + } + +end: + return equal; +} + LTTNG_HIDDEN bool lttng_trace_chunk_get(struct lttng_trace_chunk *chunk) {