Re: [PATCH] HID: Major update to N-Trig touchscreen

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, 4 Feb 2010, Dmitry Torokhov wrote:

>  +
> > +		if (matched < nd->contact_count) {
> > +			for (i = 0; i < nd->contact_count; i++) {
> > +				if (nd->contacts[i].logical_id < 0) {
> > +					for (j = 0; j < nd->prev_contact_count;
> > +					     j++) {
> > +						if (nd->
> > +						    prev_contacts[j].confidence
> > +						    &&
> > +						    (contact_map
> > +						     [nd->
> > +						      prev_contacts
> > +						      [j].logical_id] < 0)
> > +						    &&
> > +						    (abs
> > +						     (nd->contacts[i].x -
> > +						      nd->prev_contacts[j].x) <
> > +						     nd->max_width)
> > +						    &&
> > +						    (abs
> > +						     (nd->contacts[i].y -
> > +						      nd->prev_contacts[j].y) <
> > +						     nd->max_height)) {
> > +							nd->contacts
> > +							    [i].logical_id =
> > +							    nd->prev_contacts
> > +							    [j].logical_id;
> > +							contact_map
> > +							    [nd->prev_contacts
> > +							     [j].logical_id]
> > +							    = i;
> > +							matched++;
> 
> OK, this kind code just makes me want to poke my eyes with a fork... 5
> times...
> 
> Seriously, either factor it out into a nice function, or say "screw it"
> to the 80 columt limit, or maybe both. Anything but this.

I absolutely agree with Dmitry here.

Plus, even if formatted/factored-out properky, the condition seems to be 
very unintuitivie. Maybe a line of two of comments, explaining what is the 
actual condition testing, might be very helpful.

Thanks,

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux