render: fix "maybe-uninitialized" error in draw_styled_underline()

Reproducer:

    CFLAGS='-Og -g' meson setup --buildtype=debug bld
    ninja -C bld

Error message:

    ../render.c: In function ‘draw_styled_underline’:
    ../render.c:490:19: error: ‘y_ofs’ may be used uninitialized
    [-Werror=maybe-uninitialized]
      490 |         const int top = y + y_ofs;
          |                   ^~~
    ../render.c:405:9: note: ‘y_ofs’ was declared here
      405 |     int y_ofs;
          |         ^~~~~
This commit is contained in:
Craig Barnes 2024-07-03 06:55:01 +01:00
parent ab4b3cbd34
commit 970b95509c

View file

@ -420,8 +420,9 @@ draw_styled_underline(const struct terminal *term, pixman_image_t *pix,
case UNDERLINE_NONE:
case UNDERLINE_SINGLE:
BUG("underline styles not supposed to be handled here");
break;
default:
BUG("unexpected underline style: %d", (int)style);
return;
}
const int ceil_w = cols * term->cell_width;