(tests): Add tst-iconv2.
[kopensolaris-gnu/glibc.git] / iconv / gconv_conf.c
index 15a5907..b7e7692 100644 (file)
@@ -202,12 +202,14 @@ insert_module (struct gconv_module *newp, int tobefreed)
                  || (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;
-               }
+                 newp->left = root->left;
+                 newp->right = root->right;
+                 newp->same = root->same;
+                 *rootp = newp;
 
-             if (tobefreed)
+                 free (root);
+               }
+             else if (tobefreed)
                free (newp);
              return;
            }
@@ -349,7 +351,7 @@ read_conf_file (const char *filename, const char *directory, size_t dir_len,
   FILE *fp = fopen (filename, "r");
   char *line = NULL;
   size_t line_len = 0;
-  int modcounter = 0;
+  static int modcounter;
 
   /* Don't complain if a file is not present or readable, simply silently
      ignore it.  */