about summary refs log tree commit diff
path: root/iconv/iconv_prog.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-01-18 23:15:16 +0000
committerUlrich Drepper <drepper@redhat.com>1999-01-18 23:15:16 +0000
commit2bd608801708e2fa3d0e39f1220604a81a036a78 (patch)
tree8e941c6a4cd4d12302fcaa0a78dd1c6a88dad16f /iconv/iconv_prog.c
parent464d646f3e667e42742a995b841080ec7b6a1540 (diff)
downloadglibc-2bd608801708e2fa3d0e39f1220604a81a036a78.tar.gz
glibc-2bd608801708e2fa3d0e39f1220604a81a036a78.tar.xz
glibc-2bd608801708e2fa3d0e39f1220604a81a036a78.zip
Update.
1999-01-18  Ulrich Drepper  <drepper@cygnus.com>

	* iconv/gconv_conf.c (add_module): Complete rewrite.  Use cleverer
	data structures and avoid creating intermediate representations
	first.  Rewrite also all helper functions.
	* iconv/gconv_db.c (find_derivation): Use new data structure for
	module database.
	* iconv/Versions: Remove __gconv_nmodules.
	* iconv/iconv_prog.c: Rewrite generation of charset name list to
	use new data structure.
	* iconv/gconv_int.h (struct gconv_module): Add new elements for
	database data structure.
	(__gconv_modules_db): Update type.
	(__gconv_transform_dummy): Removed.
	* iconv/gconv_builtin.h: Remove dummy transformation.
	* iconv/gconv_simple.c: Remove __gconv_transform_dummy.

	* sysdeps/unix/sysv/linux/sparc/sparc32/syscalls.list: Remove
	__syscall_vfork, add vfork.
	* sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise.

	* Rules: Add dummp.c and dummy.o to common-generated.
Diffstat (limited to 'iconv/iconv_prog.c')
-rw-r--r--iconv/iconv_prog.c50
1 files changed, 32 insertions, 18 deletions
diff --git a/iconv/iconv_prog.c b/iconv/iconv_prog.c
index 8f05d57a18..78fa6234f4 100644
--- a/iconv/iconv_prog.c
+++ b/iconv/iconv_prog.c
@@ -99,7 +99,7 @@ static int process_block (iconv_t cd, const char *addr, size_t len,
 			  FILE *output);
 static int process_fd (iconv_t cd, int fd, FILE *output);
 static int process_file (iconv_t cd, FILE *input, FILE *output);
-static void print_known_names (void);
+static void print_known_names (void) internal_function;
 
 
 int
@@ -503,9 +503,38 @@ do_print  (const void *nodep, VISIT value, int level)
 }
 
 static void
+internal_function
+add_known_names (struct gconv_module *node)
+{
+  if (node->left != NULL)
+    add_known_names (node->left);
+  if (node->right != NULL)
+    add_known_names (node->right);
+  if (node->same != NULL)
+    add_known_names (node->same);
+  do
+    {
+      if (node->from_pattern == NULL)
+	{
+	  if (strcmp (node->from_constpfx, "INTERNAL"))
+	    tsearch (node->from_constpfx, &printlist,
+		     (__compar_fn_t) strverscmp);
+	  if (strcmp (node->to_string, "INTERNAL"))
+	    tsearch (node->to_string, &printlist, (__compar_fn_t) strverscmp);
+	}
+      else
+	if (strcmp (node->from_pattern, "INTERNAL"))
+	  tsearch (node->from_pattern, &printlist, (__compar_fn_t) strverscmp);
+
+      node = node->matching;
+    }
+  while (node != NULL);
+}
+
+static void
+internal_function
 print_known_names (void)
 {
-  size_t cnt;
   iconv_t h;
 
   /* We must initialize the internal databases first.  */
@@ -516,22 +545,7 @@ print_known_names (void)
   twalk (__gconv_alias_db, insert_print_list);
 
   /* Add the from- and to-names from the known modules.  */
-  for (cnt = 0; cnt < __gconv_nmodules; ++cnt)
-    {
-      if (__gconv_modules_db[cnt]->from_pattern == NULL)
-	{
-	  if (strcmp (__gconv_modules_db[cnt]->from_constpfx, "INTERNAL"))
-	    tsearch (__gconv_modules_db[cnt]->from_constpfx, &printlist,
-		     (__compar_fn_t) strverscmp);
-	  if (strcmp (__gconv_modules_db[cnt]->to_string, "INTERNAL"))
-	    tsearch (__gconv_modules_db[cnt]->to_string, &printlist,
-		     (__compar_fn_t) strverscmp);
-	}
-      else
-	if (strcmp (__gconv_modules_db[cnt]->from_pattern, "INTERNAL"))
-	  tsearch (__gconv_modules_db[cnt]->from_pattern, &printlist,
-		   (__compar_fn_t) strverscmp);
-    }
+  add_known_names (__gconv_modules_db);
 
   fputs (_("\
 The following list contain all the coded character sets known.  This does\n\