- size += lttng_write_sequence_mystruct_mysequence(buf, to, from, len, &obj->mysequence);
-
- size += lttng_write_mystruct_myunion(buf, to, from, len, &obj->myunion);
+ lttng_write_sequence_mystruct_mysequence(to_base, to, from, len, &obj->mysequence);
+ *to = 0; /* Force the compiler to know it's 0 */
+ /* After this previous write, we are sure that *to is 0, and *to_base is
+ * aligned on the architecture size : to rest of alignment will be calculated
+ * statically. */
+
+ lttng_write_mystruct_myunion(to_base, to, from, len, &obj->myunion);