Messages in this thread | | | Date | Tue, 20 Sep 2011 21:47:57 +0400 | From | Evgeniy Polyakov <> | Subject | Re: POHMELFS is back |
| |
On Tue, Sep 20, 2011 at 11:05:17AM -0600, Rick Morgan (rikmorgan@gmail.com) wrote: > <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
Please do not use inline html
> <pre wrap="">+static inline int dnet_id_cmp_str(const unsigned char *id1, const unsigned char *id2) > +{ > + unsigned int <b>i = 0</b>; > + > + for (<b>i*=sizeof</b>(unsigned long); i<DNET_ID_SIZE; ++i) { > + if (id1[i] < id2[i]) > + return -1; > + if (id1[i] > id2[i]) > + return 1; > + } > + > + return 0; > +} > </pre> > </blockquote> > if i is initialized to 0, wouldn't i*=sizeof(unsigned long) be zero?<br>
Yes, it counts from zero. This chunk previously checked another parameter first, but since then it was removed, but checking loop remained.
-- Evgeniy Polyakov
| |