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

Mark Kettenis mark.kettenis at xs4all.nl
Sun Jul 7 14:15:10 PDT 2013


> From: =?UTF-8?q?St=C3=A9phane=20Aulery?= <lkppo at free.fr>
> Date: Sun,  7 Jul 2013 22:50:28 +0200

What's the point of these changes?

> 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
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: http://lists.x.org/mailman/listinfo/xorg-devel
> 
> 


More information about the xorg-devel mailing list