chiark / gitweb /
journal: delete unused function journal_file_skip_entry()
authorMichal Schmidt <mschmidt@redhat.com>
Tue, 16 Dec 2014 14:47:01 +0000 (15:47 +0100)
committerMichal Schmidt <mschmidt@redhat.com>
Thu, 18 Dec 2014 10:53:08 +0000 (11:53 +0100)
Its only caller is a test.

src/journal/journal-file.c
src/journal/journal-file.h
src/journal/test-journal.c

index 75a7c11..efe14b0 100644 (file)
@@ -1995,55 +1995,6 @@ int journal_file_next_entry(
         return 1;
 }
 
-int journal_file_skip_entry(
-                JournalFile *f,
-                Object *o, uint64_t p,
-                int64_t skip,
-                Object **ret, uint64_t *offset) {
-
-        uint64_t i, n;
-        int r;
-
-        assert(f);
-        assert(o);
-        assert(p > 0);
-
-        if (o->object.type != OBJECT_ENTRY)
-                return -EINVAL;
-
-        r = generic_array_bisect(f,
-                                 le64toh(f->header->entry_array_offset),
-                                 le64toh(f->header->n_entries),
-                                 p,
-                                 test_object_offset,
-                                 DIRECTION_DOWN,
-                                 NULL, NULL,
-                                 &i);
-        if (r <= 0)
-                return r;
-
-        /* Calculate new index */
-        if (skip < 0) {
-                if ((uint64_t) -skip >= i)
-                        i = 0;
-                else
-                        i = i - (uint64_t) -skip;
-        } else
-                i  += (uint64_t) skip;
-
-        n = le64toh(f->header->n_entries);
-        if (n <= 0)
-                return -EBADMSG;
-
-        if (i >= n)
-                i = n-1;
-
-        return generic_array_get(f,
-                                 le64toh(f->header->entry_array_offset),
-                                 i,
-                                 ret, offset);
-}
-
 int journal_file_next_entry_for_data(
                 JournalFile *f,
                 Object *o, uint64_t p,
index 8c3f308..3514bef 100644 (file)
@@ -176,7 +176,6 @@ int journal_file_find_field_object(JournalFile *f, const void *field, uint64_t s
 int journal_file_find_field_object_with_hash(JournalFile *f, const void *field, uint64_t size, uint64_t hash, Object **ret, uint64_t *offset);
 
 int journal_file_next_entry(JournalFile *f, Object *o, uint64_t p, direction_t direction, Object **ret, uint64_t *offset);
-int journal_file_skip_entry(JournalFile *f, Object *o, uint64_t p, int64_t skip, Object **ret, uint64_t *offset);
 
 int journal_file_next_entry_for_data(JournalFile *f, Object *o, uint64_t p, uint64_t data_offset, direction_t direction, Object **ret, uint64_t *offset);
 
index ff9dc9e..29d5877 100644 (file)
@@ -80,15 +80,6 @@ static void test_non_empty(void) {
         assert_se(journal_file_next_entry(f, NULL, 0, DIRECTION_DOWN, &o, &p) == 1);
         assert_se(le64toh(o->entry.seqnum) == 1);
 
-        assert_se(journal_file_skip_entry(f, o, p, 2, &o, &p) == 1);
-        assert_se(le64toh(o->entry.seqnum) == 3);
-
-        assert_se(journal_file_skip_entry(f, o, p, -2, &o, &p) == 1);
-        assert_se(le64toh(o->entry.seqnum) == 1);
-
-        assert_se(journal_file_skip_entry(f, o, p, -2, &o, &p) == 1);
-        assert_se(le64toh(o->entry.seqnum) == 1);
-
         assert_se(journal_file_find_data_object(f, test, strlen(test), NULL, &p) == 1);
         assert_se(journal_file_next_entry_for_data(f, NULL, 0, p, DIRECTION_DOWN, &o, NULL) == 1);
         assert_se(le64toh(o->entry.seqnum) == 1);