mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-24 02:03:54 +03:00
journal: delete unused function journal_file_skip_entry()
Its only caller is a test.
This commit is contained in:
parent
ae2adbcd09
commit
14499361a5
@ -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,
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user