[PATCH 1/3] lib: Add ip6_common_octets function

Toke Høiland-Jørgensen toke at toke.dk
Tue Jun 6 14:49:36 CEST 2017


Ondrej Zajicek <santiago at crfreenet.org> writes:

> On Tue, Jun 06, 2017 at 01:00:38PM +0200, Toke Høiland-Jørgensen wrote:
>> Christian Tacke <Christian.Tacke+bird.network.cz at cosmokey.com> writes:
>> 
>> > Hi,
>> >
>> > just out of curiosity:
>> >
>> > On Mon, Jun 05, 2017 at 23:49:52 +0200, Toke Høiland-Jørgensen wrote:
>> > [...]
>> >> +int
>> >> +ip6_common_octets(ip6_addr a, ip6_addr b)
>> >> +{
>> >> +  int i, j, common = 0;
>> > [...]
>> >
>> > Why aren't you using an unsigned int here?
>> 
>> No particular reason; I suppose muscle memory kicked in and gave me an
>> 'int'. You are right, of course, that it should probably be uint... :)
>
> Well, beware of down-iteration in for():
>
>   for (j=3; j>=0; j--)
>
> That would not work with uint.

Right, but I was mostly referring to the return type. Anyway, that
function is not really needed anymore, since the new version of the
patch compares buffers instead; so guess you can drop that patch.

Will send v2 of the other patch along in a sec...

-Toke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 487 bytes
Desc: not available
URL: <http://trubka.network.cz/pipermail/bird-users/attachments/20170606/be4029f1/attachment.asc>


More information about the Bird-users mailing list