summary refs log tree commit diff
path: root/iconv/gconv_conf.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-08-31 06:37:47 +0000
committerUlrich Drepper <drepper@redhat.com>2000-08-31 06:37:47 +0000
commitb2fe29ddb550a0f8c6d92b6d4467dd8f0bc1f1c8 (patch)
tree55019e54dfe941dff3c4b14ecfd1bb03f12e5fef /iconv/gconv_conf.c
parentf55727ca53308a206cf00d0442f8c57c73761899 (diff)
downloadglibc-b2fe29ddb550a0f8c6d92b6d4467dd8f0bc1f1c8.tar.gz
glibc-b2fe29ddb550a0f8c6d92b6d4467dd8f0bc1f1c8.tar.xz
glibc-b2fe29ddb550a0f8c6d92b6d4467dd8f0bc1f1c8.zip
Update.
	* iconv/gconv_conf.c (insert_module): Take extra parameter to decide
	whether the new record should be freed if it's a duplicate.
	(add_module): Adjust insert_module call.
	(__gconv_read_conf): Likewise.
	* iconvdata/Makefile (generated): Add tst-loading.mtrace and
	mtrace-tst-loading.
	(tests): Make $(objpfx)mtrace-tst-loading a dependency.  Add rule.
Diffstat (limited to 'iconv/gconv_conf.c')
-rw-r--r--iconv/gconv_conf.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/iconv/gconv_conf.c b/iconv/gconv_conf.c
index eb0ea7181e..7f81a546ae 100644
--- a/iconv/gconv_conf.c
+++ b/iconv/gconv_conf.c
@@ -170,7 +170,7 @@ add_alias (char *rp, void *modules)
 /* Insert a data structure for a new module in the search tree.  */
 static inline void
 internal_function
-insert_module (struct gconv_module *newp)
+insert_module (struct gconv_module *newp, int tobefreed)
 {
   struct gconv_module **rootp = &__gconv_modules_db;
 
@@ -194,8 +194,12 @@ insert_module (struct gconv_module *newp)
 	    }
 
 	  if (root != NULL)
-	    /* This is a no new conversion.  */
-	    return;
+	    {
+	      /* This is a no new conversion.  */
+	      if (tobefreed)
+		free (newp);
+	      return;
+	    }
 
 	  break;
 	}
@@ -324,7 +328,7 @@ add_module (char *rp, const char *directory, size_t dir_len, void **modules,
 	memcpy (tmp - 1, gconv_module_ext, sizeof (gconv_module_ext));
 
       /* Now insert the new module data structure in our search tree.  */
-      insert_module (new_module);
+      insert_module (new_module, 1);
     }
 }
 
@@ -529,7 +533,7 @@ __gconv_read_conf (void)
 	/* It'll conflict so don't add it.  */
 	continue;
 
-      insert_module (&builtin_modules[cnt]);
+      insert_module (&builtin_modules[cnt], 0);
     }
 
   /* Add aliases for builtin conversions.  */