Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 85718
Collapse All | Expand All

(-)iconv/iconvconfig.c.orig (-26 / +32 lines)
Lines 1013-1018 Link Here
1013
                              module name offset
1013
                              module name offset
1014
                         (following last entry with step count 0)
1014
                         (following last entry with step count 0)
1015
*/
1015
*/
1016
1017
/* Function to insert the names.  */
1018
/* Made non-nested to avoid trampoline.
1019
 * Requires hash_table and hash_size to be made global,
1020
 * but since the caller (write_output) is called once
1021
 * in the only thread there should be no problem */
1022
static struct hash_entry *hash_table;
1023
static size_t hash_size;
1024
static void
1025
name_insert (const void *nodep, VISIT value, int level)
1026
  {
1027
    struct name *name;
1028
    unsigned int idx;
1029
    unsigned int hval2;
1030
1031
    if (value != leaf && value != postorder)
1032
      return;
1033
1034
    name = *(struct name **) nodep;
1035
    idx = name->hashval % hash_size;
1036
    hval2 = 1 + name->hashval % (hash_size - 2);
1037
1038
    while (hash_table[idx].string_offset != 0)
1039
      if ((idx += hval2) >= hash_size)
1040
	idx -= hash_size;
1041
1042
    hash_table[idx].string_offset = strtaboffset (name->strent);
1043
1044
    assert (name->module_idx != -1);
1045
    hash_table[idx].module_idx = name->module_idx;
1046
  }
1047
1016
static int
1048
static int
1017
write_output (void)
1049
write_output (void)
1018
{
1050
{
Lines 1020-1027 Link Here
1020
  char *string_table;
1052
  char *string_table;
1021
  size_t string_table_size;
1053
  size_t string_table_size;
1022
  struct gconvcache_header header;
1054
  struct gconvcache_header header;
1023
  struct hash_entry *hash_table;
1024
  size_t hash_size;
1025
  struct module_entry *module_table;
1055
  struct module_entry *module_table;
1026
  char *extra_table;
1056
  char *extra_table;
1027
  char *cur_extra_table;
1057
  char *cur_extra_table;
Lines 1034-1063 Link Here
1034
  char tmpfname[(output_file == NULL ? sizeof finalname : output_file_len + 1)
1064
  char tmpfname[(output_file == NULL ? sizeof finalname : output_file_len + 1)
1035
		+ strlen (".XXXXXX")];
1065
		+ strlen (".XXXXXX")];
1036
1066
1037
  /* Function to insert the names.  */
1038
  auto void
1039
  name_insert (const void *nodep, VISIT value, int level)
1040
    {
1041
      struct name *name;
1042
      unsigned int idx;
1043
      unsigned int hval2;
1044
1045
      if (value != leaf && value != postorder)
1046
	return;
1047
1048
      name = *(struct name **) nodep;
1049
      idx = name->hashval % hash_size;
1050
      hval2 = 1 + name->hashval % (hash_size - 2);
1051
1052
      while (hash_table[idx].string_offset != 0)
1053
	if ((idx += hval2) >= hash_size)
1054
	  idx -= hash_size;
1055
1056
      hash_table[idx].string_offset = strtaboffset (name->strent);
1057
1058
      assert (name->module_idx != -1);
1059
      hash_table[idx].module_idx = name->module_idx;
1060
    }
1061
1067
1062
  /* Open the output file.  */
1068
  /* Open the output file.  */
1063
  if (output_file == NULL)
1069
  if (output_file == NULL)

Return to bug 85718