# HG changeset patch # User Matti Hamalainen # Date 1535725914 -10800 # Node ID 7114ea4c3c42da5d5fab9700ab591ee14e86f9be # Parent c5a88bb4ee3f5133e6004f1f55d75a51b1748069 Cleanup. diff -r c5a88bb4ee3f -r 7114ea4c3c42 tools/libgfx.c --- a/tools/libgfx.c Wed Aug 29 22:01:29 2018 +0300 +++ b/tools/libgfx.c Fri Aug 31 17:31:54 2018 +0300 @@ -950,7 +950,8 @@ dmMemset(&hdr, 0, sizeof(hdr)); if (spec.paletted) { - for (int i = 0; i < (img->ncolors > DMPCX_PAL_COLORS ? DMPCX_PAL_COLORS : img->ncolors); i++) + const int ncolors = img->ncolors > DMPCX_PAL_COLORS ? DMPCX_PAL_COLORS : img->ncolors; + for (int i = 0; i < ncolors; i++) { hdr.colorMap[i].r = img->pal[i].r; hdr.colorMap[i].g = img->pal[i].g;