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

walter harms wharms at bfs.de
Mon Jul 8 03:53:43 PDT 2013



Am 07.07.2013 22:50, schrieb Stéphane Aulery:
> 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();

Hi Stéphane,
IMHO this is hard to read and micro optimisation.
NTL can you replace that loop with meset(mem,0, soieof(mem)) ?

re,
 wh


More information about the xorg-devel mailing list