From c5c3447ca8a71ab3cfd84a2b5fd2c193ef5b4fb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 14 Mar 2021 14:19:12 +0100 Subject: [PATCH] sixel: sixel_overwrite_at_cursor(): early exit when the image list is empty This avoids a call to sixel_overwrite_by_row() (where we also exit early if the image list is empty). This saves a couple of instructions to set up the arguments for sixel_overwrite_by_row(). --- sixel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sixel.c b/sixel.c index 96ba9214..be4981cf 100644 --- a/sixel.c +++ b/sixel.c @@ -610,6 +610,9 @@ sixel_overwrite_by_row(struct terminal *term, int _row, int col, int width) void sixel_overwrite_at_cursor(struct terminal *term, int width) { + if (likely(tll_length(term->grid->sixel_images) == 0)) + return; + sixel_overwrite_by_row( term, term->grid->cursor.point.row, term->grid->cursor.point.col, width); }