DragonFly BSD
DragonFly commits List (threaded) for 2005-03
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: cvs commit: src/sbin/route route.c


From: Chris Pressey <cpressey@xxxxxxxxxxxxxxx>
Date: Tue, 15 Mar 2005 21:21:36 -0800

On Tue, 15 Mar 2005 21:10:07 -0800
Chris Pressey <cpressey@xxxxxxxxxxxxxxx> wrote:

> On Wed, 16 Mar 2005 05:56:34 +0100
> Joerg Sonnenberger <joerg@xxxxxxxxxxxxxxxxx> wrote:
> 
> > On Tue, Mar 15, 2005 at 08:47:01PM -0800, Chris Pressey wrote:
> > >   
> > >   - start at sa_data, end at sa + sa_len (NOT sa_data + sa_len);
> > >   - don't make assumptions about the size of u_short.
> > 
> > Actually this code this makes assumptions :)
> 
> Would uint16_t be preferable here?
> 
> > I think it should be:
> > splim = (u_short *)sa +
> >     (sa->sa_len - offsetof(sa->sa_data)) / sizeof(u_short);
> 
> I think that should be
> 
>   splim = (u_short *)sa->sa_data +
>       (sa->sa_len - offsetof(sa->sa_data)) / sizeof(u_short);
> 
> but that'd be the same as the thing I committed, just longer.

(With the exception of the "+ 1", which AFAICT is there so that the
division by sizeof(u_short) (or ">> 1" in the old version) doesn't cut
off the last short if sa_len is odd...)

-Chris



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