/* from marker.c */
extern long marker_update_fields_offsets(struct marker_info *info, const char *data);
+extern void marker_update_event_fields_offsets(GArray *fields_offsets,
+ struct marker_info *info);
/* Tracefile names used in this file */
perror("Cannot map block for tracefile");
goto close_file;
}
-
+
+ /* Create fields offset table */
+ tf->event.fields_offsets = g_array_sized_new(FALSE, FALSE,
+ sizeof(struct LttField), 1);
+ if (!tf->event.fields_offsets)
+ goto close_file;
+
return 0;
/* Error */
close(t->fd);
if (t->buf_index)
g_array_free(t->buf_index, TRUE);
+ g_array_free(t->event.fields_offsets, TRUE);
}
/****************************************************************************
}
} else if(ltt_time_compare(time, tf->buffer.begin.timestamp) < 0) {
- /* go to lower part */
- high = block_num - 1;
+ /*
+ * Go to lower part. We don't want block_num - 1 since block_num
+ * can equal low , in which case high < low.
+ */
+ high = block_num;
} else if(ltt_time_compare(time, tf->buffer.end.timestamp) > 0) {
/* go to higher part */
low = block_num + 1;
if (info->size != -1)
size = info->size;
else
- size = marker_update_fields_offsets(marker_get_info_from_id(tf->mdata,
- tf->event.event_id), tf->event.data);
+ size = marker_update_fields_offsets(info, tf->event.data);
+ /* Update per-tracefile offsets */
+ marker_update_event_fields_offsets(tf->event.fields_offsets, info);
}
tf->event.data_size = size;