ip6_sprintf patch

Bjoern A. Zeeb bzeeb-lists at lists.zabbadoz.net
Wed Dec 13 05:21:19 PST 2006


On Tue, 12 Dec 2006, Max Laier wrote:

> On Tuesday 12 December 2006 13:22, Bjoern A. Zeeb wrote:
>> +		}
>> +		*cp = digits[*d & 0xf];
>
>> +		if (zero == 0 || (*cp != '0'))
>> +			cp++;
>
> This last if is redundant as we check for "(u_int16_t)0" at the very
> begining.  If we didn't, you should still get rid of the if-check here as
> we might otherwise have more than one "::" in the address.
>
>>   		*cp++ = ':';
>>   		a++;
>>   	}

ok looks like
 	..
                 }
                 *cp++ = digits[*d & 0xf];
                 *cp++ = ':';
                 a++;
         }

now.

And I have run some tests (in case someone wants to check):
http://sources.zabbadoz.net/freebsd/ipv6/ip6_sprintf.c

Thanks.

-- 
Bjoern A. Zeeb				bzeeb at Zabbadoz dot NeT


More information about the freebsd-net mailing list