summaryrefslogtreecommitdiff
path: root/locale
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2005-10-20 06:59:57 +0000
committerJakub Jelinek <jakub@redhat.com>2005-10-20 06:59:57 +0000
commitb7071f6fc41f4c20510de3683f39e5c8ea8a2e1e (patch)
tree852f4f1992a3c9ecbb44b822df6702c7e635fc5a /locale
parentacfebba27b162b3064c616142883541eaef3f725 (diff)
downloadglibc-b7071f6fc41f4c20510de3683f39e5c8ea8a2e1e.tar.gz
Updated to fedora-glibc-20051020T0651
Diffstat (limited to 'locale')
-rw-r--r--locale/localeinfo.h7
-rw-r--r--locale/programs/ld-collate.c12
2 files changed, 12 insertions, 7 deletions
diff --git a/locale/localeinfo.h b/locale/localeinfo.h
index 065ee18cf9..3b0ed4f30b 100644
--- a/locale/localeinfo.h
+++ b/locale/localeinfo.h
@@ -1,5 +1,5 @@
/* Declarations for internal libc locale interfaces
- Copyright (C) 1995-2001, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1995-2001, 2002, 2003, 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -31,7 +31,10 @@
#include <intl/loadinfo.h> /* For loaded_l10nfile definition. */
/* Magic number at the beginning of a locale data file for CATEGORY. */
-#define LIMAGIC(category) ((unsigned int) (0x20031115 ^ (category)))
+#define LIMAGIC(category) \
+ (category == LC_COLLATE \
+ ? ((unsigned int) (0x20051014 ^ (category))) \
+ : ((unsigned int) (0x20031115 ^ (category))))
/* Two special weight constants for the collation data. */
#define IGNORE_CHAR 2
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
index 6d0d03c235..00ad2ee488 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);
}