diff options
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | iconv/iconvconfig.c | 4 | ||||
-rw-r--r-- | locale/programs/ld-collate.c | 4 |
3 files changed, 11 insertions, 4 deletions
@@ -1,3 +1,10 @@ +2019-03-21 DJ Delorie <dj@redhat.com> + + [BZ #24372] + * iconv/iconvconfig.c (write_output): Replace floating point math + with integer math to avoid imprecise results. + * locale/programs/ld-collate.c (collate_output): Likewise. + 2019-03-21 Stefan Liebler <stli@linux.ibm.com> * sysdeps/s390/dl-procinfo.h (HWCAP_IMPORTANT): diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c index 0201450..1e6066c 100644 --- a/iconv/iconvconfig.c +++ b/iconv/iconvconfig.c @@ -1079,9 +1079,9 @@ write_output (void) /* Create the hashing table. We know how many strings we have. Creating a perfect hash table is not reasonable here. Therefore - we use open hashing and a table size which is the next prime 40% + we use open hashing and a table size which is the next prime 50% larger than the number of strings. */ - hash_size = next_prime (nnames * 1.4); + hash_size = next_prime (nnames + nnames >> 1); hash_table = (struct hash_entry *) xcalloc (hash_size, sizeof (struct hash_entry)); /* Fill the hash table. */ diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index bb4e2c5..19b23c2 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -2401,8 +2401,8 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap, runp = runp->next; } - /* Add 40% and find the next prime number. */ - elem_size = next_prime (elem_size * 1.4); + /* Add 50% and find the next prime number. */ + elem_size = next_prime (elem_size + elem_size >> 1); /* Allocate the table. Each entry consists of two words: the hash value and an index in a secondary table which provides the index |