- if (j->current_location.type == LOCATION_HEAD)
- r = journal_file_next_entry_for_data(f, NULL, 0, dp, DIRECTION_DOWN, &c, &cp);
- else if (j->current_location.type == LOCATION_TAIL)
- r = journal_file_next_entry_for_data(f, NULL, 0, dp, DIRECTION_UP, &c, &cp);
- else if (j->current_location.seqnum_set &&
- sd_id128_equal(j->current_location.seqnum_id, f->header->seqnum_id))
- r = journal_file_move_to_entry_by_seqnum_for_data(f, dp, j->current_location.seqnum, direction, &c, &cp);
- else if (j->current_location.realtime_set)
- r = journal_file_move_to_entry_by_realtime_for_data(f, dp, j->current_location.realtime, direction, &c, &cp);
- else
- r = journal_file_next_entry_for_data(f, NULL, 0, dp, direction, &c, &cp);
-
- if (!term_match) {
- term_match = m;
-
- if (r > 0) {
- to = c;
- tp = cp;
- }
- } else if (same_field(term_match->data, term_match->size, m->data, m->size)) {
-
- /* Same field as previous match... */
- if (r > 0) {
-
- /* Find the earliest of the OR matches */
-
- if (!to ||
- (direction == DIRECTION_DOWN && cp < tp) ||
- (direction == DIRECTION_UP && cp > tp)) {
- to = c;
- tp = cp;
- }
-
- }
-
- } else {
-
- /* Previous term is finished, did anything match? */
- if (!to)
- return 0;