From 49fbeb9a56025ac28bc38482385836266ccb90a7 Mon Sep 17 00:00:00 2001 From: pagedown Date: Sat, 1 Jan 2022 21:27:01 +0800 Subject: [PATCH] Remove the always true conditions Unsigned integers are always greater than or equal to zero. The else branch is always the opposite. --- kitty/freetype.c | 2 +- kitty/freetype_render_ui_text.c | 2 +- kitty/screen.c | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/kitty/freetype.c b/kitty/freetype.c index 96c6c36d1..0f4d12a86 100644 --- a/kitty/freetype.c +++ b/kitty/freetype.c @@ -92,7 +92,7 @@ get_load_flags(int hinting, int hintstyle, int base) { int flags = base; if (hinting) { if (hintstyle >= 3) flags |= FT_LOAD_TARGET_NORMAL; - else if (0 < hintstyle && hintstyle < 3) flags |= FT_LOAD_TARGET_LIGHT; + else if (0 < hintstyle) flags |= FT_LOAD_TARGET_LIGHT; } else flags |= FT_LOAD_NO_HINTING; return flags; } diff --git a/kitty/freetype_render_ui_text.c b/kitty/freetype_render_ui_text.c index 040b80cf0..c5e3abfa2 100644 --- a/kitty/freetype_render_ui_text.c +++ b/kitty/freetype_render_ui_text.c @@ -93,7 +93,7 @@ get_load_flags(int hinting, int hintstyle, int base) { int flags = base; if (hinting) { if (hintstyle >= 3) flags |= FT_LOAD_TARGET_NORMAL; - else if (0 < hintstyle && hintstyle < 3) flags |= FT_LOAD_TARGET_LIGHT; + else if (0 < hintstyle) flags |= FT_LOAD_TARGET_LIGHT; } else flags |= FT_LOAD_NO_HINTING; return flags; } diff --git a/kitty/screen.c b/kitty/screen.c index 0e61dddea..61bb230d6 100644 --- a/kitty/screen.c +++ b/kitty/screen.c @@ -1705,9 +1705,9 @@ screen_delete_lines(Screen *self, unsigned int count) { void screen_insert_characters(Screen *self, unsigned int count) { - const unsigned int top = 0, bottom = self->lines ? self->lines - 1 : 0; + const unsigned int bottom = self->lines ? self->lines - 1 : 0; if (count == 0) count = 1; - if (top <= self->cursor->y && self->cursor->y <= bottom) { + if (self->cursor->y <= bottom) { unsigned int x = self->cursor->x; unsigned int num = MIN(self->columns - x, count); linebuf_init_line(self->linebuf, self->cursor->y); @@ -1732,9 +1732,9 @@ void screen_delete_characters(Screen *self, unsigned int count) { MOVE_OVERLAY_LINE_WITH_CURSOR; // Delete characters, later characters are moved left - const unsigned int top = 0, bottom = self->lines ? self->lines - 1 : 0; + const unsigned int bottom = self->lines ? self->lines - 1 : 0; if (count == 0) count = 1; - if (top <= self->cursor->y && self->cursor->y <= bottom) { + if (self->cursor->y <= bottom) { unsigned int x = self->cursor->x; unsigned int num = MIN(self->columns - x, count); linebuf_init_line(self->linebuf, self->cursor->y);