Skip to contentSkip to conversation

avoid clang warning about dead store to "size"

PATCH In review Jim Meyering 2 participants 2 messages May 23, 2011 – Jul 8, 2011

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 avoid clang warning about dead store to "size"

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 <[email protected]>
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.

---
 ChangeLog      |    3 +++
 src/memalloc.c |    2 +-
 2 files changed, 4 insertions(+), 1 deletions(-)
ChangeLog +3 -0
index 56c5c3f..8725b08 100644
@@ -1,8 +1,11 @@
 2011-05-23  Jim Meyering  <[email protected]>
 
+	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 <[email protected]>
 
src/memalloc.c +1 -1
index 9fea067..d8e4413 100644
@@ -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

#1 lore raw
Quoted 6 lines · Jim Meyering

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.

Signature · 3 lines
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt