mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-08-25 07:33:11 +00:00
PPP, IPv6, reduce size of llv6_ntoa() function
Reduced static buffer to the strict necessary (26 bytes), removed call to eui64_ntoa(), merged eui64_ntoa() into llv6_ntoa(). 272 bytes (code + static buffers) to 140 bytes on x86_64. Improved eui64_ntoa() as well, we don't need it anymore but I'd like to keep all eui64_* helpers functions.
This commit is contained in:
parent
7fce9346dc
commit
af722a2978
@ -45,9 +45,9 @@
|
|||||||
* eui64_ntoa - Make an ascii representation of an interface identifier
|
* eui64_ntoa - Make an ascii representation of an interface identifier
|
||||||
*/
|
*/
|
||||||
char *eui64_ntoa(eui64_t e) {
|
char *eui64_ntoa(eui64_t e) {
|
||||||
static char buf[32];
|
static char buf[20];
|
||||||
|
|
||||||
snprintf(buf, 32, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
sprintf(buf, "%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
||||||
e.e8[0], e.e8[1], e.e8[2], e.e8[3],
|
e.e8[0], e.e8[1], e.e8[2], e.e8[3],
|
||||||
e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
|
e.e8[4], e.e8[5], e.e8[6], e.e8[7]);
|
||||||
return buf;
|
return buf;
|
||||||
|
@ -412,9 +412,12 @@ printifaceid(opt, printer, arg)
|
|||||||
static char *
|
static char *
|
||||||
llv6_ntoa(eui64_t ifaceid)
|
llv6_ntoa(eui64_t ifaceid)
|
||||||
{
|
{
|
||||||
static char b[64];
|
static char b[26];
|
||||||
|
|
||||||
|
sprintf(b, "fe80::%02x%02x:%02x%02x:%02x%02x:%02x%02x",
|
||||||
|
ifaceid.e8[0], ifaceid.e8[1], ifaceid.e8[2], ifaceid.e8[3],
|
||||||
|
ifaceid.e8[4], ifaceid.e8[5], ifaceid.e8[6], ifaceid.e8[7]);
|
||||||
|
|
||||||
sprintf(b, "fe80::%s", eui64_ntoa(ifaceid));
|
|
||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user