From d5b5ba6de358f4370f41c0cdcfaa8ef4546d19b0 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Sun, 9 Aug 2009 18:33:18 +0000 Subject: [PATCH] Fixed stupid bug and some comments in 24bit color reduction. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@986 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- op_c.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/op_c.c b/op_c.c index 947792c5..5a0f99e8 100644 --- a/op_c.c +++ b/op_c.c @@ -855,13 +855,13 @@ void CS_Sort_by_luminance(T_Cluster_set * cs) T_Cluster* place; T_Cluster* newlist = NULL; - while((nc = cs->clusters)) + while(cs->clusters) { // Remove the first cluster from the original list nc = cs->clusters; cs->clusters = cs->clusters->next; - // Find his position in the new list + // Find its position in the new list for(place = newlist;place != NULL; place = place->next) { if(place->l > nc->l) break; @@ -873,9 +873,12 @@ void CS_Sort_by_luminance(T_Cluster_set * cs) if(prev) prev->next = nc; else newlist = nc; + // reset prev pointer + prev = NULL; + } - // Put the new list bavk in place + // Put the new list back in place cs->clusters = newlist; }