Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Remove recursion from shrink_buffer()

There's no need for it any longer since the list is now doubly-
linked. As a bonus, stack limits pose no barrier to the length of
the list.

Change-Id: I41c567f946b640ef1e3c2d93da2f5aef9a763c66

+9 -11
+9 -11
apps/buffering.c
··· 132 132 #define HLIST_LAST \ 133 133 HLIST_HANDLE(handle_list.tail) 134 134 135 + #define HLIST_PREV(h) \ 136 + HLIST_HANDLE((h)->hnode.prev) 137 + 135 138 #define HLIST_NEXT(h) \ 136 139 HLIST_HANDLE((h)->hnode.next) 137 140 ··· 1583 1586 } 1584 1587 1585 1588 /** -- buffer thread helpers -- **/ 1586 - static void shrink_buffer_inner(struct memory_handle *h) 1589 + static void shrink_buffer(void) 1587 1590 { 1588 - if (h == NULL) 1589 - return; 1591 + logf("shrink_buffer()"); 1590 1592 1591 - shrink_buffer_inner(HLIST_NEXT(h)); 1593 + mutex_lock(&llist_mutex); 1592 1594 1593 - shrink_handle(h); 1594 - } 1595 + for (struct memory_handle *h = HLIST_LAST; h; h = HLIST_PREV(h)) { 1596 + shrink_handle(h); 1597 + } 1595 1598 1596 - static void shrink_buffer(void) 1597 - { 1598 - logf("shrink_buffer()"); 1599 - mutex_lock(&llist_mutex); 1600 - shrink_buffer_inner(HLIST_FIRST); 1601 1599 mutex_unlock(&llist_mutex); 1602 1600 } 1603 1601