Replace all assert(false) and assert(0) with abort()
[babeltrace.git] / lib / ctf-writer / serialize.c
index e2fa56d79bb85fb33376656b27bb0794b4881d35..f20ad405cb99cdcebbb76ac1a4f9ae0c53d9e6a7 100644 (file)
@@ -28,6 +28,7 @@
  * SOFTWARE.
  */
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <stdint.h>
 #include <babeltrace/ctf-ir/field-types.h>
@@ -108,7 +109,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos,
                        break;
                }
                default:
-                       assert(BT_FALSE);
+                       abort();
                }
        } else {
                switch (size) {
@@ -147,7 +148,7 @@ int aligned_integer_write(struct bt_ctf_stream_pos *pos,
                        break;
                }
                default:
-                       assert(BT_FALSE);
+                       abort();
                }
        }
 
@@ -275,14 +276,14 @@ void bt_ctf_stream_pos_packet_seek(struct bt_ctf_stream_pos *pos, size_t index,
                /* unmap old base */
                ret = munmap_align(pos->base_mma);
                if (ret) {
-                       assert(BT_FALSE);
+                       // FIXME: this can legitimately fail?
+                       abort();
                }
                pos->base_mma = NULL;
        }
 
        /* The writer will add padding */
        pos->mmap_offset += pos->packet_size / CHAR_BIT;
-       pos->content_size = -1U;        /* Unknown at this point */
        pos->packet_size = getpagesize() * 8 * CHAR_BIT;
        do {
                ret = bt_posix_fallocate(pos->fd, pos->mmap_offset,
@@ -295,6 +296,7 @@ void bt_ctf_stream_pos_packet_seek(struct bt_ctf_stream_pos *pos, size_t index,
        pos->base_mma = mmap_align(pos->packet_size / CHAR_BIT, pos->prot,
                pos->flags, pos->fd, pos->mmap_offset);
        if (pos->base_mma == MAP_FAILED) {
-               assert(BT_FALSE);
+               // FIXME: this can legitimately fail?
+               abort();
        }
 }
This page took 0.024424 seconds and 4 git commands to generate.