about summary refs log tree commit diff
path: root/iconv
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2004-09-22 21:21:10 +0000
committerRoland McGrath <roland@gnu.org>2004-09-22 21:21:10 +0000
commitb5707b44d25d7af61b0338c2a2206c036eaf7337 (patch)
treed8b9e865cbc78d64835a63959370865a2a043223 /iconv
parent4ff389feb39f2eb649530b843d478c80c27ab4cf (diff)
downloadglibc-b5707b44d25d7af61b0338c2a2206c036eaf7337.tar.gz
glibc-b5707b44d25d7af61b0338c2a2206c036eaf7337.tar.xz
glibc-b5707b44d25d7af61b0338c2a2206c036eaf7337.zip
Changes and additions migrated from cvs.devel.redhat.com:/cvs/devel/glibc to fedora-branch
Diffstat (limited to 'iconv')
-rw-r--r--iconv/iconvconfig.c54
1 files changed, 28 insertions, 26 deletions
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
index da0d54f43b..e95d073a22 100644
--- a/iconv/iconvconfig.c
+++ b/iconv/iconvconfig.c
@@ -989,6 +989,34 @@ next_prime (uint32_t seed)
                               module name offset
                          (following last entry with step count 0)
 */
+
+static struct hash_entry *hash_table;
+static size_t hash_size;
+
+/* Function to insert the names.  */
+static void name_insert (const void *nodep, VISIT value, int level)
+{
+  struct name *name;
+  unsigned int idx;
+  unsigned int hval2;
+
+  if (value != leaf && value != postorder)
+    return;
+
+  name = *(struct name **) nodep;
+  idx = name->hashval % hash_size;
+  hval2 = 1 + name->hashval % (hash_size - 2);
+
+  while (hash_table[idx].string_offset != 0)
+    if ((idx += hval2) >= hash_size)
+      idx -= hash_size;
+
+  hash_table[idx].string_offset = strtaboffset (name->strent);
+
+  assert (name->module_idx != -1);
+  hash_table[idx].module_idx = name->module_idx;
+}
+
 static int
 write_output (void)
 {
@@ -996,8 +1024,6 @@ write_output (void)
   char *string_table;
   size_t string_table_size;
   struct gconvcache_header header;
-  struct hash_entry *hash_table;
-  size_t hash_size;
   struct module_entry *module_table;
   char *extra_table;
   char *cur_extra_table;
@@ -1010,30 +1036,6 @@ write_output (void)
 		+ strlen (".XXXXXX")];
   char finalname[prefix_len + sizeof (GCONV_MODULES_CACHE)];
 
-  /* Function to insert the names.  */
-  static void name_insert (const void *nodep, VISIT value, int level)
-    {
-      struct name *name;
-      unsigned int idx;
-      unsigned int hval2;
-
-      if (value != leaf && value != postorder)
-	return;
-
-      name = *(struct name **) nodep;
-      idx = name->hashval % hash_size;
-      hval2 = 1 + name->hashval % (hash_size - 2);
-
-      while (hash_table[idx].string_offset != 0)
-	if ((idx += hval2) >= hash_size)
-	  idx -= hash_size;
-
-      hash_table[idx].string_offset = strtaboffset (name->strent);
-
-      assert (name->module_idx != -1);
-      hash_table[idx].module_idx = name->module_idx;
-    }
-
   /* Open the output file.  */
   assert (GCONV_MODULES_CACHE[0] == '/');
   strcpy (stpcpy (mempcpy (tmpfname, prefix, prefix_len), GCONV_MODULES_CACHE),