diff options
author | Michal Schmidt <mschmidt@redhat.com> | 2014-12-16 15:47:01 +0100 |
---|---|---|
committer | Michal Schmidt <mschmidt@redhat.com> | 2014-12-18 11:53:08 +0100 |
commit | 14499361a537f769fadfb2e9323c8a65d31e6862 (patch) | |
tree | a0d022852fd7fc173296c6a4d2f75daeaed722c5 /src/journal | |
parent | ae2adbcd09bd383b5a18728dfd32cf604c2c910e (diff) |
journal: delete unused function journal_file_skip_entry()
Its only caller is a test.
Diffstat (limited to 'src/journal')
-rw-r--r-- | src/journal/journal-file.c | 49 | ||||
-rw-r--r-- | src/journal/journal-file.h | 1 | ||||
-rw-r--r-- | src/journal/test-journal.c | 9 |
3 files changed, 0 insertions, 59 deletions
diff --git a/src/journal/journal-file.c b/src/journal/journal-file.c index 75a7c11a0a..efe14b0d92 100644 --- a/src/journal/journal-file.c +++ b/src/journal/journal-file.c @@ -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, diff --git a/src/journal/journal-file.h b/src/journal/journal-file.h index 8c3f308ff2..3514bef0ef 100644 --- a/src/journal/journal-file.h +++ b/src/journal/journal-file.h @@ -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); diff --git a/src/journal/test-journal.c b/src/journal/test-journal.c index ff9dc9e170..29d5877986 100644 --- a/src/journal/test-journal.c +++ b/src/journal/test-journal.c @@ -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); |