[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 4/8] mbsstr: port --enable-gcc-warnings to clang
From: |
Paul Eggert |
Subject: |
[PATCH 4/8] mbsstr: port --enable-gcc-warnings to clang |
Date: |
Wed, 15 May 2013 00:36:58 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130510 Thunderbird/17.0.6 |
* lib/mbsstr.c (knuth_morris_pratt_multibyte):
Avoid casts from looser to stricter-aligned pointers.
---
ChangeLog | 4 ++++
lib/mbsstr.c | 7 ++++---
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 508458e..1a8925a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2013-05-15 Paul Eggert <address@hidden>
+ mbsstr: port --enable-gcc-warnings to clang
+ * lib/mbsstr.c (knuth_morris_pratt_multibyte):
+ Avoid casts from looser to stricter-aligned pointers.
+
malloca: port --enable-gcc-warnings to clang
* lib/malloca.c (struct header): New member 'magic', to avoid casts.
(mmalloca): Avoid casts from looser to stricter-aligned pointers.
diff --git a/lib/mbsstr.c b/lib/mbsstr.c
index f84e689..24cff25 100644
--- a/lib/mbsstr.c
+++ b/lib/mbsstr.c
@@ -45,11 +45,12 @@ knuth_morris_pratt_multibyte (const char *haystack, const
char *needle,
size_t *table;
/* Allocate room for needle_mbchars and the table. */
- char *memory = (char *) nmalloca (m, sizeof (mbchar_t) + sizeof (size_t));
+ void *memory = nmalloca (m, sizeof (mbchar_t) + sizeof (size_t));
+ void *table_memory;
if (memory == NULL)
return false;
- needle_mbchars = (mbchar_t *) memory;
- table = (size_t *) (memory + m * sizeof (mbchar_t));
+ needle_mbchars = memory;
+ table = table_memory = needle_mbchars + m;
/* Fill needle_mbchars. */
{
--
1.7.11.7
- Re: [libvirt] [PATCH 4/6] Correctly detect warning flags with clang, Eric Blake, 2013/05/13
- Re: [libvirt] [PATCH 4/6] Correctly detect warning flags with clang, Paul Eggert, 2013/05/15
- [PATCH 2/8] inttostr: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 3/8] malloca: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 4/8] mbsstr: port --enable-gcc-warnings to clang,
Paul Eggert <=
- [PATCH 5/8] memchr2: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 6/8] obstack: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 7/8] sig2str: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 8/8] stdio: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang, Eric Blake, 2013/05/15
- Re: [PATCH 8/8] stdio: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked, Paul Eggert, 2013/05/15
- Re: [PATCH 1/4] stdio: use __REDIRECT for fwrite, fwrite_unlocked, Eric Blake, 2013/05/16
- [PATCH 2/4] thread: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15
- [PATCH 3/4] getaddrinfo-tests: port --enable-gcc-warnings to clang, Paul Eggert, 2013/05/15