aboutsummaryrefslogtreecommitdiff
path: root/locale/programs
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-10-14 22:56:25 +0000
committerUlrich Drepper <drepper@redhat.com>2005-10-14 22:56:25 +0000
commit7d4722e3fd1c4205bba9fddf7a1de611d5151ebd (patch)
treead47ea3abe962721a12650a82287c317b7d681b6 /locale/programs
parentdaa226125cf9570ac726e21fc33d19101123a5c0 (diff)
downloadglibc-7d4722e3fd1c4205bba9fddf7a1de611d5151ebd.zip
glibc-7d4722e3fd1c4205bba9fddf7a1de611d5151ebd.tar.gz
glibc-7d4722e3fd1c4205bba9fddf7a1de611d5151ebd.tar.bz2
[BZ #368]
* SUPPORTED (SUPPORTED-LOCALES): Add dz_BT.UTF-8. [BZ #368] * locales/dz_BT: New file.
Diffstat (limited to 'locale/programs')
-rw-r--r--locale/programs/ld-collate.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 6d0d03c..00ad2ee 100644
--- a/locale/programs/ld-collate.c
+++ b/locale/programs/ld-collate.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2002, 2003 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@gnu.org>, 1995.
@@ -2469,14 +2469,14 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
runp = collate->start;
while (runp != NULL)
{
- if (runp->mbs != NULL && runp->weights != NULL)
+ if (runp->mbs != NULL && runp->weights != NULL && !runp->is_character)
/* Yep, the element really counts. */
++elem_size;
runp = runp->next;
}
/* Add 40% and find the next prime number. */
- elem_size = MIN (next_prime (elem_size * 1.4), 257);
+ elem_size = next_prime (elem_size * 1.4);
/* Allocate the table. Each entry consists of two words: the hash
value and an index in a secondary table which provides the index
@@ -2496,18 +2496,20 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
uint32_t namelen = strlen (runp->name);
uint32_t hash = elem_hash (runp->name, namelen);
size_t idx = hash % elem_size;
+ size_t start_idx = idx;
if (elem_table[idx * 2] != 0)
{
- /* The spot is already take. Try iterating using the value
+ /* The spot is already taken. Try iterating using the value
from the secondary hashing function. */
- size_t iter = hash % (elem_size - 2);
+ size_t iter = hash % (elem_size - 2) + 1;
do
{
idx += iter;
if (idx >= elem_size)
idx -= elem_size;
+ assert (idx != start_idx);
}
while (elem_table[idx * 2] != 0);
}