[PATCH 14/20] dix: rename "res" to "result" for improved readability

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 20 15:05:45 PDT 2011


On Thu, Apr 21, 2011 at 12:34:20AM +0200, Simon Thum wrote:
> On 04/20/2011 08:28 AM, Peter Hutterer wrote:
> > Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
> > ---
> >  dix/ptrveloc.c |   18 +++++++++---------
> >  1 files changed, 9 insertions(+), 9 deletions(-)
> > 
> > diff --git a/dix/ptrveloc.c b/dix/ptrveloc.c
> > index c1b8b91..970212c 100644
> > --- a/dix/ptrveloc.c
> > +++ b/dix/ptrveloc.c
> > @@ -763,7 +763,7 @@ ComputeAcceleration(
> >      DeviceVelocityPtr vel,
> >      float threshold,
> >      float acc){
> > -    float res;
> > +    float result;
> >  
> >      if(vel->velocity <= 0){
> >  	DebugAccelF("(dix ptracc) profile skipped\n");
> > @@ -778,24 +778,24 @@ ComputeAcceleration(
> >  	 * current and previous velocity.
> >  	 * Though being the more natural choice, it causes a minor delay
> >  	 * in comparison, so it can be disabled. */
> > -	res = BasicComputeAcceleration(
> > +	result = BasicComputeAcceleration(
> >  	          dev, vel, vel->velocity, threshold, acc);
> > -	res += BasicComputeAcceleration(
> > +	result += BasicComputeAcceleration(
> >  	          dev, vel, vel->last_velocity, threshold, acc);
> > -	res += 4.0f * BasicComputeAcceleration(dev, vel,
> > +	result += 4.0f * BasicComputeAcceleration(dev, vel,
> >  	                   (vel->last_velocity + vel->velocity) / 2,
> >  	                   threshold, acc);
> > -	res /= 6.0f;
> > +	result /= 6.0f;
> >  	DebugAccelF("(dix ptracc) profile average [%.2f ... %.2f] is %.3f\n",
> > -	            vel->velocity, vel->last_velocity, res);
> > +	            vel->velocity, vel->last_velocity, result);
> >      }else{
> > -	res = BasicComputeAcceleration(dev, vel,
> > -	                               vel->velocity, threshold, acc);
> > +	result = BasicComputeAcceleration(dev, vel,
> > +	                                  vel->velocity, threshold, acc);
> >  	DebugAccelF("(dix ptracc) profile sample [%.2f] is %.3f\n",
> >                 vel->velocity, res);
> >      }
> >  
> > -    return res;
> > +    return result;
> >  }
> >  
> >  
> Hey, this was saving 27 bytes...!

Time to upgrade your hard drive? :P

Just a bit of explanation why I made this patch: I was looking at
resolution-based acceleration. And when you have that in mind, having a
variable called "res" for result is really really confusing.
Probably not a big deal otherwise, but I just could not tell my brain to
treat res as result yesterday.

> Reviewed-by: Simon Thum <simon.thum at gmx.de>

thanks

Cheers,
  Peter


More information about the xorg-devel mailing list