# HG changeset patch # User Matti Hamalainen # Date 1529404008 -10800 # Node ID d53bdee5ffa5e4e11124ee8251c7578111830efd # Parent dcb12cd340d340d9f08af64da904fa714d7569c4 Remove slight bit of code duplication. diff -r dcb12cd340d3 -r d53bdee5ffa5 tools/gfxconv.c --- a/tools/gfxconv.c Tue Jun 19 12:03:16 2018 +0300 +++ b/tools/gfxconv.c Tue Jun 19 13:26:48 2018 +0300 @@ -912,35 +912,20 @@ } } - // Fill in the rest if (optRemapRemove) + dmMsg(2, "Removing unused colors.\n"); + + for (index = 0; index < src->ncolors; index++) + if (mapping[index] < 0 && + (!optRemapRemove || (optRemapRemove && used[index]))) { - dmMsg(2, "Removing unused colors.\n"); - for (index = 0; index < src->ncolors; index++) - if (mapping[index] < 0 && used[index]) + for (n = 0; n < src->ncolors; n++) + if (!mapped[n]) { - for (n = 0; n < src->ncolors; n++) - if (!mapped[n]) - { - mapping[index] = n; - mapped[n] = TRUE; - break; - } - } - } - else - { - for (index = 0; index < src->ncolors; index++) - if (mapping[index] < 0) - { - for (n = 0; n < src->ncolors; n++) - if (!mapped[n]) - { - mapping[index] = n; - mapped[n] = TRUE; - break; - } + mapping[index] = n; + mapped[n] = TRUE; + break; } }