1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-11-02 08:57:19 -04:00

[screen] minor optimisation

This commit is contained in:
Witold Filipczyk 2022-12-14 22:18:10 +01:00
parent 571cb05e05
commit df5dd1515e

View File

@ -1507,7 +1507,6 @@ resize_screen(struct terminal *term, int width, int height)
{ {
struct terminal_screen *screen; struct terminal_screen *screen;
struct screen_char *image; struct screen_char *image;
struct bitfield *new_dirty;
size_t size, bsize; size_t size, bsize;
assert(term && term->screen); assert(term && term->screen);
@ -1520,8 +1519,11 @@ resize_screen(struct terminal *term, int width, int height)
size = width * height; size = width * height;
if (size <= 0) return; if (size <= 0) return;
new_dirty = init_bitfield(height); if (term->height != height) {
struct bitfield *new_dirty = init_bitfield(height);
if (!new_dirty) return; if (!new_dirty) return;
mem_free_set(&screen->dirty, new_dirty);
}
bsize = size * sizeof(*image); bsize = size * sizeof(*image);
@ -1536,7 +1538,6 @@ resize_screen(struct terminal *term, int width, int height)
term->width = width; term->width = width;
term->height = height; term->height = height;
mem_free_set(&screen->dirty, new_dirty);
set_screen_dirty(screen, 0, height); set_screen_dirty(screen, 0, height);
} }