networking/libiproute/*: code shrink by optimizing numeric conversions
and other misc stuff function old new delta print_tunnel 660 656 -4 format_host 5 - -5 get_unsigned 70 54 -16 get_u32 70 54 -16 do_iplink 1173 1151 -22 get_prefix 417 393 -24 print_rule 800 771 -29 print_addrinfo 1374 1342 -32 print_route 1745 1709 -36 iprule_modify 905 866 -39 iproute_modify 1105 1048 -57 get_integer 70 - -70 parse_args 1684 1440 -244 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/11 up/down: 0/-594) Total: -594 bytes text data bss dec hex filename 817378 476 7892 825746 c9992 busybox_old 816784 476 7892 825152 c9740 busybox_unstripped
This commit is contained in:
@@ -280,17 +280,16 @@ static int print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
|
||||
|
||||
if (rta_tb[IFA_LOCAL]) {
|
||||
fputs(rt_addr_n2a(ifa->ifa_family,
|
||||
RTA_PAYLOAD(rta_tb[IFA_LOCAL]),
|
||||
RTA_DATA(rta_tb[IFA_LOCAL]),
|
||||
abuf, sizeof(abuf)), stdout);
|
||||
|
||||
if (rta_tb[IFA_ADDRESS] == NULL ||
|
||||
memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0) {
|
||||
if (rta_tb[IFA_ADDRESS] == NULL
|
||||
|| memcmp(RTA_DATA(rta_tb[IFA_ADDRESS]), RTA_DATA(rta_tb[IFA_LOCAL]), 4) == 0
|
||||
) {
|
||||
printf("/%d ", ifa->ifa_prefixlen);
|
||||
} else {
|
||||
printf(" peer %s/%d ",
|
||||
rt_addr_n2a(ifa->ifa_family,
|
||||
RTA_PAYLOAD(rta_tb[IFA_ADDRESS]),
|
||||
RTA_DATA(rta_tb[IFA_ADDRESS]),
|
||||
abuf, sizeof(abuf)),
|
||||
ifa->ifa_prefixlen);
|
||||
@@ -300,14 +299,12 @@ static int print_addrinfo(const struct sockaddr_nl *who UNUSED_PARAM,
|
||||
if (rta_tb[IFA_BROADCAST]) {
|
||||
printf("brd %s ",
|
||||
rt_addr_n2a(ifa->ifa_family,
|
||||
RTA_PAYLOAD(rta_tb[IFA_BROADCAST]),
|
||||
RTA_DATA(rta_tb[IFA_BROADCAST]),
|
||||
abuf, sizeof(abuf)));
|
||||
}
|
||||
if (rta_tb[IFA_ANYCAST]) {
|
||||
printf("any %s ",
|
||||
rt_addr_n2a(ifa->ifa_family,
|
||||
RTA_PAYLOAD(rta_tb[IFA_ANYCAST]),
|
||||
RTA_DATA(rta_tb[IFA_ANYCAST]),
|
||||
abuf, sizeof(abuf)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user