This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
PATCH: Fix undeclared variable error in memset.c
- From: Nathanael Nerode <neroden at twcny dot rr dot com>
- To: newlib at sources dot redhat dot com
- Date: Wed, 27 Nov 2002 12:40:04 -0500
- Subject: PATCH: Fix undeclared variable error in memset.c
"d" is declared in an inner block and then used in an outer block; this
causes a compile error, preventing newlib from finishing its build.
Fixed by moving declaration of "d" out of the "if" block.
Please tell me if this is OK to commit.
Index: memset.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/string/memset.c,v
retrieving revision 1.4
diff -u -r1.4 memset.c
--- memset.c 25 Nov 2002 21:11:58 -0000 1.4
+++ memset.c 27 Nov 2002 17:37:41 -0000
@@ -60,12 +60,12 @@
unsigned long buffer;
unsigned long *aligned_addr;
+ /* To avoid sign extention, copy C to an unsigned variable. */
+ unsigned int d = c & 0xff;
+
if (!TOO_SMALL (n) && !UNALIGNED (m))
{
/* If we get this far, we know that n is large and m is word-aligned. */
-
- /* To avoid sign extention, copy C to an unsigned variable. */
- unsigned int d = c & 0xff;
aligned_addr = (unsigned long*)m;