From 8d46530578e0bd31d42f106ad550b0db9bcdc116 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Sat, 2 Feb 2019 12:32:07 +1100 Subject: [PATCH] rearrange i_new_hatch_low() in fills.c The code used to be a bunch of conditional expressions, which some Sun C compiler complained about. Rearrange the code to be a lot more obvious. Related to CID 185339. --- fills.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/fills.c b/fills.c index 4754e265..b2305802 100644 --- a/fills.c +++ b/fills.c @@ -647,25 +647,23 @@ i_new_hatch_low(const i_color *fg, const i_color *bg, i_fill_hatch_t *fill = mymalloc(sizeof(i_fill_hatch_t)); /* checked 14jul05 tonyc */ *fill = hatch_fill_proto; - /* Some Sun C didn't like the condition expressions that were here. - See https://rt.cpan.org/Ticket/Display.html?id=21944 - */ - if (fg) + if (fg && bg) { fill->fg = *fg; - else - fill->fg = fcolor_to_color(ffg); - if (bg) fill->bg = *bg; - else + fill->ffg = color_to_fcolor(fg); + fill->fbg = color_to_fcolor(bg); + } + else if (ffg && fbg) { + fill->fg = fcolor_to_color(ffg); fill->bg = fcolor_to_color(fbg); - if (ffg) fill->ffg = *ffg; - else - fill->ffg = color_to_fcolor(fg); - if (fbg) fill->fbg = *fbg; - else - fill->fbg = color_to_fcolor(bg); + } + else { + assert(0); + /* NOTREACHED */ + } + if (combine) { i_get_combine(combine, &fill->base.combine, &fill->base.combinef); } -- 2.39.5