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

Matthieu Herrb matthieu.herrb at laas.fr
Mon Jul 8 05:53:09 PDT 2013


On Sun, Jul 07, 2013 at 10:50:30PM +0200, Stéphane Aulery wrote:
> Signed-off-by: Stéphane Aulery <lkppo at free.fr>
> ---
>  math.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/math.c b/math.c
> index a8c4a5c..b09b94a 100644
> --- a/math.c
> +++ b/math.c
> @@ -751,13 +751,12 @@ void
>  offf(void)
>  {
>    /* full reset */
> -  int i;
>    ResetCalc();
>    entered=clrdisp=1;
>    lift_enabled = 0;
>    dnum=mem[0]=0.0;
>    if (rpn)
> -      for (i=1; i < XCALC_MEMORY; i++)
> +      for (int i=1; i < XCALC_MEMORY; i++)
>  	  mem[i]=0.0;
>    exponent=Dpoint=0;
>    DrawDisplay();
> -- 

This is a C99 only feature. There are still people build X with
compilers that aren't fully C99 and don't understand this idiom.

If you really want to hack on xcalc, please fix 
https://bugs.freedesktop.org/show_bug.cgi?id=10578

-- 
Matthieu Herrb


More information about the xorg-devel mailing list