[PATCH 11/20] dix: rename a bunch of variables to be more self-explanatory

Peter Hutterer peter.hutterer at who-t.net
Wed Apr 20 21:49:36 PDT 2011


On Wed, Apr 20, 2011 at 11:20:37AM -0700, Jamey Sharp wrote:
> On Wed, Apr 20, 2011 at 04:28:20PM +1000, Peter Hutterer wrote:
> > 	} else if (initial_velocity != 0) {
> > 	    velocity_diff = fabs(initial_velocity - tracker_velocity);
> > 	    if (velocity_diff <= vel->max_diff ||
> > 		velocity_diff/(initial_velocity + tracker_velocity) < vel->max_rel_diff) {
> > 		/* we're in range with the initial velocity,
> > 		 * so this result is likely better
> > 		 * (it contains more information). */
> > 		result = tracker_velocity;
> > 		used_offset = offset;
> > 	    }else{
> > 		/* we're not in range, quit - it won't get better. */
> > 		DebugAccelF("(dix prtacc) query: tracker too different:"
> > 		            " old %2.2f initial %2.2f diff: %2.2f\n",
> > 		            tracker_velocity, initial_velocity, velocity_diff);
> > 		break;
> > 	    }
> > 	}
> 
> As a minor nit, I think this code would be even more clear this way:
> 
> 	if (velocity_diff > vel->max_diff && ...) {
> 		DebugAccelF(...);
> 		break;
> 	}
> 	/* we're in range ... */
> 	result = tracker_velocity;
> 	used_offset = offset;
> 
> Another minor nit: Restructuring control flow, as you've done with the
> introduced continue statement, isn't described by a commit message of
> "rename a bunch of variables". :-)

oops, that wasn't intended, a rebase gone wrong. I've removed the control
flow change from the rename patch, will send out a separate patch for the
former.

Cheers,
  Peter


More information about the xorg-devel mailing list