fix : bt_ctf_iter_create defaults to BEGIN pos
authorJulien Desfossez <julien.desfossez@efficios.com>
Wed, 14 Mar 2012 18:58:08 +0000 (14:58 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 14 Mar 2012 18:58:08 +0000 (14:58 -0400)
With the context notion it does not make sense to start the iterator at
the current position, so we default to BT_SEEK_BEGIN if begin_pos is
NULL.

Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lib/iterator.c

index ca6e5917e449b328f6ba0869397297b60d7e4e57..f820fdb6ce87fc30196157e4dcd21fc83bdbfaba 100644 (file)
@@ -474,14 +474,22 @@ int bt_iter_init(struct bt_iter *iter,
                                                filenr);
 
                                if (begin_pos) {
                                                filenr);
 
                                if (begin_pos) {
-                                   ret = babeltrace_filestream_seek(file_stream, begin_pos,
+                                       ret = babeltrace_filestream_seek(
+                                                       file_stream,
+                                                       begin_pos,
                                                        stream_id);
                                                        stream_id);
-                                   if (ret == EOF) {
-                                          ret = 0;
-                                          continue;
-                                   } else if (ret) {
-                                          goto error;
-                                   }
+                               } else {
+                                       struct bt_iter_pos pos;
+                                       pos.type = BT_SEEK_BEGIN;
+                                       ret = babeltrace_filestream_seek(
+                                                       file_stream, &pos,
+                                                       stream_id);
+                               }
+                               if (ret == EOF) {
+                                       ret = 0;
+                                       continue;
+                               } else if (ret) {
+                                       goto error;
                                }
                                /* Add to heap */
                                ret = heap_insert(iter->stream_heap, file_stream);
                                }
                                /* Add to heap */
                                ret = heap_insert(iter->stream_heap, file_stream);
This page took 0.040912 seconds and 4 git commands to generate.