|
|
bdc76f |
commit 5abcddd7949270998c6e8d99fdbbba821b664f8b
|
|
|
bdc76f |
Author: Gabriel F. T. Gomes <gabriel@inconstante.eti.br>
|
|
|
bdc76f |
Date: Thu Mar 21 17:24:30 2019 -0300
|
|
|
bdc76f |
|
|
|
bdc76f |
Fix parentheses error in iconvconfig.c and ld-collate.c [BZ #24372]
|
|
|
bdc76f |
|
|
|
bdc76f |
When -Werror=parentheses is in use, iconvconfig.c builds fail with:
|
|
|
bdc76f |
|
|
|
bdc76f |
iconvconfig.c: In function ‘write_output’:
|
|
|
bdc76f |
iconvconfig.c:1084:34: error: suggest parentheses around ‘+’ inside ‘>>’ [-Werror=parentheses]
|
|
|
bdc76f |
hash_size = next_prime (nnames + nnames >> 1);
|
|
|
bdc76f |
~~~~~~~^~~~~~~~
|
|
|
bdc76f |
|
|
|
bdc76f |
This patch adds parentheses to the expression. Not where suggested by
|
|
|
bdc76f |
the compiler warning, but where it produces the expected result, i.e.:
|
|
|
bdc76f |
where it has the effect of multiplying nnames by 1.5.
|
|
|
bdc76f |
|
|
|
bdc76f |
Likewise for elem_size in ld-collate.c.
|
|
|
bdc76f |
|
|
|
bdc76f |
Tested for powerpc64le.
|
|
|
bdc76f |
|
|
|
bdc76f |
Reviewed-by: Carlos O'Donell <carlos@redhat.com>
|
|
|
bdc76f |
|
|
|
bdc76f |
diff --git a/iconv/iconvconfig.c b/iconv/iconvconfig.c
|
|
|
bdc76f |
index 696fc8d31231ca2d..b6fef1553cbbdd3d 100644
|
|
|
bdc76f |
--- a/iconv/iconvconfig.c
|
|
|
bdc76f |
+++ b/iconv/iconvconfig.c
|
|
|
bdc76f |
@@ -1081,7 +1081,7 @@ write_output (void)
|
|
|
bdc76f |
Creating a perfect hash table is not reasonable here. Therefore
|
|
|
bdc76f |
we use open hashing and a table size which is the next prime 50%
|
|
|
bdc76f |
larger than the number of strings. */
|
|
|
bdc76f |
- hash_size = next_prime (nnames + nnames >> 1);
|
|
|
bdc76f |
+ hash_size = next_prime (nnames + (nnames >> 1));
|
|
|
bdc76f |
hash_table = (struct hash_entry *) xcalloc (hash_size,
|
|
|
bdc76f |
sizeof (struct hash_entry));
|
|
|
bdc76f |
/* Fill the hash table. */
|
|
|
bdc76f |
diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c
|
|
|
bdc76f |
index 9a1639b999d0e2aa..a5530655fd5638b5 100644
|
|
|
bdc76f |
--- a/locale/programs/ld-collate.c
|
|
|
bdc76f |
+++ b/locale/programs/ld-collate.c
|
|
|
bdc76f |
@@ -2402,7 +2402,7 @@ collate_output (struct localedef_t *locale, const struct charmap_t *charmap,
|
|
|
bdc76f |
runp = runp->next;
|
|
|
bdc76f |
}
|
|
|
bdc76f |
/* Add 50% and find the next prime number. */
|
|
|
bdc76f |
- elem_size = next_prime (elem_size + elem_size >> 1);
|
|
|
bdc76f |
+ elem_size = next_prime (elem_size + (elem_size >> 1));
|
|
|
bdc76f |
|
|
|
bdc76f |
/* Allocate the table. Each entry consists of two words: the hash
|
|
|
bdc76f |
value and an index in a secondary table which provides the index
|