[PATCH xcalc 1/3] Reduce scope of tmp (cppcheck --verbose --enable=all)

Stéphane Aulery lkppo at free.fr
Sun Jul 7 13:50:28 PDT 2013


Signed-off-by: Stéphane Aulery <lkppo at free.fr>
---
 math.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/math.c b/math.c
index de33f7e..7332372 100644
--- a/math.c
+++ b/math.c
@@ -175,10 +175,10 @@ static void
 DrawDisplay(void)
 {
     if ((int) strlen(dispstr) > 12) {	 /* strip out some decimal digits */
-        char tmp[32];
         char *estr = index(dispstr,'e');  /* search for exponent part */
         if (!estr) dispstr[12]='\0';      /* no exp, just trunc. */
         else {
+            char tmp[32];
             if ((int) strlen(estr) <= 4)
                 sprintf(tmp,"%.8s",dispstr); /* leftmost 8 chars */
             else
-- 
1.7.10.4



More information about the xorg-devel mailing list