diff options
author | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2004-12-22 20:10:10 +0000 |
commit | a334319f6530564d22e775935d9c91663623a1b4 (patch) | |
tree | b5877475619e4c938e98757d518bb1e9cbead751 /iconv/iconvconfig.c | |
parent | 0ecb606cb6cf65de1d9fc8a919bceb4be476c602 (diff) | |
download | glibc-a334319f6530564d22e775935d9c91663623a1b4.zip glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.gz glibc-a334319f6530564d22e775935d9c91663623a1b4.tar.bz2 |
(CFLAGS-tst-align.c): Add -mpreferred-stack-boundary=4.
Diffstat (limited to 'iconv/iconvconfig.c')
-rw-r--r-- | iconv/iconvconfig.c | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c index 59867f9..7424091 100644 --- a/iconv/iconvconfig.c +++ b/iconv/iconvconfig.c @@ -1,20 +1,22 @@ /* Generate fastloading iconv module configuration files. - Copyright (C) 2000-2004, 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper <drepper@redhat.com>, 2000. - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License version 2 as - published by the Free Software Foundation. + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. - This program is distributed in the hope that it will be useful, + The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software Foundation, - Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ #include <argp.h> #include <assert.h> @@ -339,7 +341,7 @@ main (int argc, char *argv[]) if (status == 0) status = write_output (); else - error (1, 0, _("no output file produced because warnings were issued")); + error (1, 0, _("no output file produced because warning were issued")); return status; } @@ -395,7 +397,7 @@ print_version (FILE *stream, struct argp_state *state) Copyright (C) %s Free Software Foundation, Inc.\n\ This is free software; see the source for copying conditions. There is NO\n\ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\ -"), "2006"); +"), "2004"); fprintf (stream, gettext ("Written by %s.\n"), "Ulrich Drepper"); } @@ -983,11 +985,11 @@ next_prime (uint32_t seed) Offset Length Description 0000 4 Magic header bytes - 0004 2 Offset of string table (stoff) - 0006 2 Offset of name hashing table (hoff) - 0008 2 Hashing table size (hsize) - 000A 2 Offset of module table (moff) - 000C 2 Offset of other conversion module table (ooff) + 0004 4 Offset of string table (stoff) + 0008 4 Offset of name hashing table (hoff) + 000C 4 Hashing table size (hsize) + 0010 4 Offset of module table (moff) + 0014 4 Offset of other conversion module table (ooff) stoff ??? String table @@ -1011,34 +1013,6 @@ 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) { @@ -1046,6 +1020,8 @@ 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; @@ -1058,6 +1034,31 @@ write_output (void) char tmpfname[(output_file == NULL ? sizeof finalname : output_file_len + 1) + strlen (".XXXXXX")]; + /* Function to insert the names. */ + auto 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. */ if (output_file == NULL) { @@ -1177,9 +1178,6 @@ write_output (void) } } - /* Clear padding. */ - memset (&header, 0, sizeof (struct gconvcache_header)); - header.magic = GCONVCACHE_MAGIC; iov[0].iov_base = &header; |