chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
journal: simplify set_location()
[elogind.git]
/
src
/
journal
/
sd-journal.c
diff --git
a/src/journal/sd-journal.c
b/src/journal/sd-journal.c
index adaf402f46ced2781f32b590444dd80f390b6c27..5a00cb0c9475699565124432f94706e7ce48ece4 100644
(file)
--- a/
src/journal/sd-journal.c
+++ b/
src/journal/sd-journal.c
@@
-114,20
+114,19
@@
static void init_location(Location *l, LocationType type, JournalFile *f, Object
l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
}
l->seqnum_set = l->realtime_set = l->monotonic_set = l->xor_hash_set = true;
}
-static void set_location(sd_journal *j, LocationType type, JournalFile *f, Object *o,
- direction_t direction, uint64_t offset) {
+static void set_location(sd_journal *j, JournalFile *f, Object *o) {
assert(j);
assert(j);
- assert(type == LOCATION_DISCRETE || type == LOCATION_SEEK);
assert(f);
assert(o);
assert(f);
assert(o);
- init_location(&j->current_location,
type
, f, o);
+ init_location(&j->current_location,
LOCATION_DISCRETE
, f, o);
j->current_file = f;
j->current_field = 0;
j->current_file = f;
j->current_field = 0;
- f->last_direction = direction;
- f->current_offset = offset;
+ /* Let f know its candidate entry was picked. */
+ assert(f->location_type == LOCATION_SEEK);
+ f->location_type = LOCATION_DISCRETE;
}
static int match_is_valid(const void *data, size_t size) {
}
static int match_is_valid(const void *data, size_t size) {
@@
-855,6
+854,8
@@
static int next_beyond_location(sd_journal *j, JournalFile *f, direction_t direc
found = true;
if (found) {
found = true;
if (found) {
+ journal_file_save_location(f, direction, c, cp);
+
if (ret)
*ret = c;
if (offset)
if (ret)
*ret = c;
if (offset)
@@
-887,8
+888,10
@@
static int real_journal_next(sd_journal *j, direction_t direction) {
log_debug_errno(r, "Can't iterate through %s, ignoring: %m", f->path);
remove_file_real(j, f);
continue;
log_debug_errno(r, "Can't iterate through %s, ignoring: %m", f->path);
remove_file_real(j, f);
continue;
- } else if (r == 0)
+ } else if (r == 0) {
+ f->location_type = LOCATION_TAIL;
continue;
continue;
+ }
if (!new_file)
found = true;
if (!new_file)
found = true;
@@
-913,7
+916,7
@@
static int real_journal_next(sd_journal *j, direction_t direction) {
if (r < 0)
return r;
if (r < 0)
return r;
- set_location(j,
LOCATION_DISCRETE, new_file, o, direction, new_offset
);
+ set_location(j,
new_file, o
);
return 1;
}
return 1;
}