summaryrefslogtreecommitdiff
path: root/src/feeds.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/feeds.c')
-rw-r--r--src/feeds.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/feeds.c b/src/feeds.c
index 5034c616..7e54a633 100644
--- a/src/feeds.c
+++ b/src/feeds.c
@@ -440,6 +440,11 @@ void deinit_Feeds(void) {
440 deinit_SortedArray(&d->entries); 440 deinit_SortedArray(&d->entries);
441} 441}
442 442
443static int cmpTimeDescending_FeedEntryPtr_(const void *a, const void *b) {
444 const iFeedEntry * const *e1 = a, * const *e2 = b;
445 return -cmp_Time(&(*e1)->timestamp, &(*e2)->timestamp);
446}
447
443const iPtrArray *listEntries_Feeds(void) { 448const iPtrArray *listEntries_Feeds(void) {
444 iFeeds *d = &feeds_; 449 iFeeds *d = &feeds_;
445 lock_Mutex(d->mtx); 450 lock_Mutex(d->mtx);
@@ -447,6 +452,6 @@ const iPtrArray *listEntries_Feeds(void) {
447 of the array in case the worker modifies it. */ 452 of the array in case the worker modifies it. */
448 iPtrArray *list = collect_PtrArray(copy_Array(&d->entries.values)); 453 iPtrArray *list = collect_PtrArray(copy_Array(&d->entries.values));
449 unlock_Mutex(d->mtx); 454 unlock_Mutex(d->mtx);
450 /* TODO: Sort the entries based on time. */ 455 sort_Array(list, cmpTimeDescending_FeedEntryPtr_);
451 return list; 456 return list;
452} 457}