Skip to contentSkip to conversation

avoid gcc warning: variable 'oldstackp' set but not used

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 gcc warning: variable 'oldstackp' set but not used

Compiling with gcc-4.6.0, I noticed a new warning. This fixes it:

From 6c4c5e33e9143946335e2adc952ea250e474926b Mon Sep 17 00:00:00 2001
From: Jim Meyering <[email protected]>
Date: Mon, 23 May 2011 10:18:27 +0200
Subject: [PATCH] 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.

---
 ChangeLog      |    6 ++++++
 src/memalloc.c |    4 +---
 2 files changed, 7 insertions(+), 3 deletions(-)
ChangeLog +6 -0
index 50a8044..56c5c3f 100644
@@ -1,3 +1,9 @@
+2011-05-23  Jim Meyering  <[email protected]>
+
+	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]>
 
 	* Fix clobbering of checkkwd.
src/memalloc.c +1 -3
index e75e609..9fea067 100644
@@ -206,20 +206,18 @@ growstackblock(void)
 {
 	size_t newlen;
 
- 	newlen = stacknleft * 2;
+	newlen = stacknleft * 2;
 	if (newlen < stacknleft)
 		sh_error("Out of space");
 	if (newlen < 128)
 		newlen += 128;
 
 	if (stacknxt == stackp->space && stackp != &stackbase) {
-		struct stack_block *oldstackp;
 		struct stack_block *sp;
 		struct stack_block *prevstackp;
 		size_t grosslen;
 
 		INTOFF;
-		oldstackp = stackp;
 		sp = stackp;
 		prevstackp = sp->prev;
 		grosslen = newlen + sizeof(struct stack_block) - MINSIZE;

--
1.7.5.2.1.g56b30

#1 lore raw
Quoted 2 lines · Jim Meyering

Compiling with gcc-4.6.0, I noticed a new warning. This fixes it:

Patch applied. Thanks Jim!

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