sixel: scroll up/down: early return when list is empty

Branch tagged as ‘likely’ for performance reason
This commit is contained in:
Daniel Eklöf 2020-10-04 19:28:22 +02:00
parent 984083bf19
commit 0a5a6cb7fa
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -242,6 +242,9 @@ out:
void
sixel_scroll_up(struct terminal *term, int rows)
{
if (likely(tll_length(term->grid->sixel_images) == 0))
return;
tll_rforeach(term->grid->sixel_images, it) {
struct sixel *six = &it->item;
@ -269,6 +272,9 @@ sixel_scroll_up(struct terminal *term, int rows)
void
sixel_scroll_down(struct terminal *term, int rows)
{
if (likely(tll_length(term->grid->sixel_images) == 0))
return;
assert(term->grid->num_rows >= rows);
tll_foreach(term->grid->sixel_images, it) {