*/
#define _LGPL_SOURCE
+#include "tracefile-array.hpp"
+
#include <common/common.hpp>
-#include <common/utils.hpp>
#include <common/defaults.hpp>
-
-#include "tracefile-array.hpp"
+#include <common/utils.hpp>
struct tracefile_array *tracefile_array_create(size_t count)
{
struct tracefile_array *tfa = NULL;
int i;
- tfa = (tracefile_array *) zmalloc(sizeof(*tfa));
+ tfa = zmalloc<tracefile_array>();
if (!tfa) {
goto error;
}
- tfa->tf = (tracefile *) zmalloc(sizeof(*tfa->tf) * count);
+ tfa->tf = calloc<tracefile>(count);
if (!tfa->tf) {
goto error;
}
tfa->file_tail = 0;
}
-void tracefile_array_file_rotate(struct tracefile_array *tfa,
- enum tracefile_rotate_type type)
+void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type)
{
uint64_t *headp, *tailp;
}
}
-void tracefile_array_commit_seq(struct tracefile_array *tfa,
- uint64_t new_seq_head)
+void tracefile_array_commit_seq(struct tracefile_array *tfa, uint64_t new_seq_head)
{
uint64_t *headp, *tailp;
return tfa->seq_tail;
}
-bool tracefile_array_seq_in_file(struct tracefile_array *tfa,
- uint64_t file_index, uint64_t seq)
+bool tracefile_array_seq_in_file(struct tracefile_array *tfa, uint64_t file_index, uint64_t seq)
{
if (!tfa->count) {
/*
if (seq == -1ULL) {
return false;
}
- if (seq >= tfa->tf[file_index].seq_tail
- && seq <= tfa->tf[file_index].seq_head) {
+ if (seq >= tfa->tf[file_index].seq_tail && seq <= tfa->tf[file_index].seq_head) {
return true;
} else {
return false;