* [PATCH] avoid clang warning about dead store to "size"
@ 2011-05-23 8:31 Jim Meyering
2011-07-08 8:16 ` Herbert Xu
0 siblings, 1 reply; 2+ messages in thread
From: Jim Meyering @ 2011-05-23 8:31 UTC (permalink / raw)
To: dash
I ran clang's scan-build on dash and it reported one nit:
ANALYZE: memalloc.c makestrspace
memalloc.c:276:9: warning: Value stored to 'size' during its initialization is never read
size_t size = stackblocksize();
^ ~~~~~~~~~~~~~~~~
From f6fb674bab5afa22de4fcfb4a2debfa4d139c73c Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering@redhat.com>
Date: Mon, 23 May 2011 10:27:57 +0200
Subject: [PATCH] avoid clang warning about dead store to "size"
* src/memalloc.c (makestrspace): Remove dead store.
Signed-off-by: Jim Meyering <meyering@redhat.com>
---
ChangeLog | 3 +++
src/memalloc.c | 2 +-
2 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 56c5c3f..8725b08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,11 @@
2011-05-23 Jim Meyering <meyering@redhat.com>
+ avoid clang warning about dead store to "size"
+ * src/memalloc.c (makestrspace): Remove dead store.
+
avoid gcc warning: variable 'oldstackp' set but not used
* src/memalloc.c (growstackblock): Remove declaration and set of
set-but-not-used variable. Also remove a stray space-before-TAB.
2011-03-15 Herbert Xu <herbert@gondor.apana.org.au>
diff --git a/src/memalloc.c b/src/memalloc.c
index 9fea067..d8e4413 100644
--- a/src/memalloc.c
+++ b/src/memalloc.c
@@ -270,13 +270,13 @@ growstackstr(void)
*/
char *
makestrspace(size_t newlen, char *p)
{
size_t len = p - stacknxt;
- size_t size = stackblocksize();
+ size_t size;
for (;;) {
size_t nleft;
size = stackblocksize();
nleft = size - len;
--
1.7.5.2.1.g56b30
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] avoid clang warning about dead store to "size"
2011-05-23 8:31 [PATCH] avoid clang warning about dead store to "size" Jim Meyering
@ 2011-07-08 8:16 ` Herbert Xu
0 siblings, 0 replies; 2+ messages in thread
From: Herbert Xu @ 2011-07-08 8:16 UTC (permalink / raw)
To: Jim Meyering; +Cc: dash
On Mon, May 23, 2011 at 08:31:43AM +0000, Jim Meyering wrote:
> I ran clang's scan-build on dash and it reported one nit:
>
> ANALYZE: memalloc.c makestrspace
> memalloc.c:276:9: warning: Value stored to 'size' during its initialization is never read
> size_t size = stackblocksize();
> ^ ~~~~~~~~~~~~~~~~
Also applied.
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-07-08 8:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 8:31 [PATCH] avoid clang warning about dead store to "size" Jim Meyering
2011-07-08 8:16 ` Herbert Xu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).