cleaned up the source_lookup

This commit is contained in:
Neil 2023-02-11 22:13:48 -08:00
parent 9d1c80076a
commit 37e8ff83f0

View File

@ -179,7 +179,7 @@ const struct source *source_lookup(struct sources *const s,
it = source_tree_less(&s->dates, x);
/* If it's before all elements of the journal or is not on the same date as
the source, this has no source, which is `list[0]` by <fn:sources>. */
if(!source_tree_has_element(&it)
|| x.date.u32 != source_tree_key(&it).date.u32) return s->list.data + 0;
return s->list.data + *source_tree_value(&it);
return s->list.data + (source_tree_has_element(&it)
&& x.date.u32 == source_tree_key(&it).date.u32
? *source_tree_value(&it) : 0);
}