(insert_module): Replace old entry if new one hsa same names but lower cost.
authordrepper <drepper>
Fri, 24 Nov 2000 21:12:50 +0000 (21:12 +0000)
committerdrepper <drepper>
Fri, 24 Nov 2000 21:12:50 +0000 (21:12 +0000)
iconv/gconv_conf.c

index a9b4581..15a5907 100644 (file)
@@ -196,7 +196,17 @@ insert_module (struct gconv_module *newp, int tobefreed)
 
          if (root != NULL)
            {
-             /* This is a no new conversion.  */
+             /* This is a no new conversion.  But maybe the cost is
+                better.  */
+             if (newp->cost_hi < root->cost_hi
+                 || (newp->cost_hi == root->cost_hi
+                     && newp->cost_lo < root->cost_lo))
+               {
+                 root->cost_hi = newp->cost_hi;
+                 root->cost_lo = newp->cost_lo;
+                 root->module_name = newp->module_name;
+               }
+
              if (tobefreed)
                free (newp);
              return;