lkml.org 
[lkml]   [2003]   [Feb]   [11]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] 2.5.59 : drivers/net/fc/iph5526.c
From Valdis.Kletnieks@vt ...
DateTue, 11 Feb 2003 04:26:59 -0500
On Tue, 11 Feb 2003 10:01:37 +0100, Horst von Brand said:

> > > > > -	for (i = 0; i < clone_list[i].vendor_id != 0; i++)

> It isn't, as written. Something is very wrong in any case, as it should
> have blown up somewhere before.

Well, currently, there's only like 3 entries in the table - two clones
and a null. So for i=0 and i=1, 'i<vendor_id' happens to be true, and we
compare that to a zero. Then for i=2, i is greater than the terminating
null in the table, and we compare THAT to zero.

> In any case, the != 0 is redundant, idiomatic C is to just go:
> 
>      for (i=0; clone_list[i].vendor_id; i++) {...

True.  Notice I said "what was intended", not "what is idiomatic". ;)
-- 
				Valdis Kletnieks
				Computer Systems Senior Engineer
				Virginia Tech

[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2005-03-22 12:33    [from the cache]
©2003-2008