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

Jamey Sharp jamey at minilop.net
Wed Apr 20 11:20:37 PDT 2011


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". :-)

Jamey
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110420/03c6d643/attachment.pgp>


More information about the xorg-devel mailing list