summary refs log tree commit diff
path: root/iconv/iconvconfig.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-07-23 23:01:08 +0000
committerUlrich Drepper <drepper@redhat.com>2001-07-23 23:01:08 +0000
commitb2e3d177abf93989afd8d647597e797f69b564df (patch)
tree4d5930a20df8076712d6319025a9c4e146f7851a /iconv/iconvconfig.c
parent4b9afc43727251609f28ba2140f4d8527e8d0d17 (diff)
downloadglibc-b2e3d177abf93989afd8d647597e797f69b564df.tar.gz
glibc-b2e3d177abf93989afd8d647597e797f69b564df.tar.xz
glibc-b2e3d177abf93989afd8d647597e797f69b564df.zip
Update.
2001-07-23  Ulrich Drepper  <drepper@redhat.com>

	* iconv/gconv_cache.c (__gconv_lookup_cache): Handle encoding from
	and to INTERNAL.
	* iconv/iconvconfig.c: Create a special record for the INTERNAL
	encoding name in the output file.
Diffstat (limited to 'iconv/iconvconfig.c')
-rw-r--r--iconv/iconvconfig.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index a8523bf25c..1d76c8f1ca 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -714,6 +714,8 @@ add_builtins (void)
 
   /* add the builtin transformations.  */
   for (cnt = 0; cnt < nbuiltin_trans; ++cnt)
+    {
+      printf("%s: %s -> %s\n", builtin_trans[cnt].module,builtin_trans[cnt].from,builtin_trans[cnt].to);
     new_module (builtin_trans[cnt].from,
 		strlen (builtin_trans[cnt].from) + 1,
 		builtin_trans[cnt].to,
@@ -721,6 +723,7 @@ add_builtins (void)
 		"", builtin_trans[cnt].module,
 		strlen (builtin_trans[cnt].module) + 1,
 		builtin_trans[cnt].cost, 0);
+    }
 }
 
 
@@ -755,6 +758,11 @@ generate_name_list (void)
 {
   size_t i;
 
+  /* A name we always need.  */
+  tsearch (new_name ("INTERNAL", strtabadd (strtab, "INTERNAL",
+					    sizeof ("INTERNAL"))),
+	   &names, name_compare);
+
   for (i = 0; i < nmodule_list; ++i)
     {
       struct module *runp;
@@ -796,10 +804,19 @@ static void
 generate_name_info (void)
 {
   size_t i;
+  int idx;
 
-  name_info = (struct name_info *) xcalloc (nmodule_list,
+  name_info = (struct name_info *) xcalloc (nmodule_list + 1,
 					    sizeof (struct name_info));
 
+  /* First add a special entry for the INTERNAL name.  This must have
+     index zero.  */
+  idx = name_to_module_idx ("INTERNAL", 1);
+  name_info[0].canonical_name = "INTERNAL";
+  name_info[0].canonical_strent = strtabadd (strtab, "INTERNAL",
+					     sizeof ("INTERNAL"));
+  assert (nname_info == 1);
+
   for (i = 0; i < nmodule_list; ++i)
     {
       struct module *runp;
@@ -807,7 +824,7 @@ generate_name_info (void)
       for (runp = module_list[i]; runp != NULL; runp = runp->next)
 	if (strcmp (runp->fromname, "INTERNAL") == 0)
 	  {
-	    int idx = name_to_module_idx (runp->toname, 1);
+	    idx = name_to_module_idx (runp->toname, 1);
 	    name_info[idx].from_internal = runp;
 	    assert (name_info[idx].canonical_name == NULL
 		    || strcmp (name_info[idx].canonical_name,
@@ -817,7 +834,7 @@ generate_name_info (void)
 	  }
 	else if (strcmp (runp->toname, "INTERNAL") == 0)
 	  {
-	    int idx = name_to_module_idx (runp->fromname, 1);
+	    idx = name_to_module_idx (runp->fromname, 1);
 	    name_info[idx].to_internal = runp;
 	    assert (name_info[idx].canonical_name == NULL
 		    || strcmp (name_info[idx].canonical_name,