libiproute: style fixes, and using smallint as appropriate

function                                             old     new   delta
print_route                                         1730    1731      +1
print_addrinfo                                      1497    1498      +1
iproute_list_or_flush                               1232    1229      -3
ipaddr_list_or_flush                                2490    2484      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 2/-9)               Total: -7 bytes
This commit is contained in:
Denis Vlasenko 2008-05-31 07:33:18 +00:00
parent 8f74094548
commit 3e57adb731
3 changed files with 24 additions and 26 deletions

View File

@ -10,8 +10,6 @@
* Laszlo Valko <valko@linux.karinthy.hu> 990223: address label must be zero terminated
*/
//#include <sys/socket.h>
//#include <sys/ioctl.h>
#include <fnmatch.h>
#include <net/if.h>
#include <net/if_arp.h>
@ -22,20 +20,20 @@
typedef struct filter_t {
int ifindex;
int family;
int oneline;
int showqueue;
inet_prefix pfx;
char *label;
char *flushb;
struct rtnl_handle *rth;
int scope, scopemask;
int flags, flagmask;
int up;
char *label;
int flushed;
char *flushb;
int flushp;
int flushe;
struct rtnl_handle *rth;
int ifindex;
family_t family;
smallint showqueue;
smallint oneline;
smallint up;
smallint flushed;
inet_prefix pfx;
} filter_t;
#define filter (*(filter_t*)&bb_common_bufsiz1)
@ -265,7 +263,7 @@ static int print_addrinfo(struct sockaddr_nl ATTRIBUTE_UNUSED *who,
fn->nlmsg_flags = NLM_F_REQUEST;
fn->nlmsg_seq = ++filter.rth->seq;
filter.flushp = (((char*)fn) + n->nlmsg_len) - filter.flushb;
filter.flushed++;
filter.flushed = 1;
return 0;
}
@ -396,7 +394,8 @@ static int store_nlmsg(struct sockaddr_nl *who, struct nlmsghdr *n, void *arg)
memcpy(&h->h, n, n->nlmsg_len);
h->next = NULL;
for (lp = linfo; *lp; lp = &(*lp)->next) /* NOTHING */;
for (lp = linfo; *lp; lp = &(*lp)->next)
continue;
*lp = h;
ll_remember_index(who, n, NULL);

View File

@ -24,7 +24,7 @@
typedef struct filter_t {
int tb;
int flushed;
smallint flushed;
char *flushb;
int flushp;
int flushe;
@ -189,7 +189,7 @@ static int print_route(struct sockaddr_nl *who ATTRIBUTE_UNUSED,
fn->nlmsg_flags = NLM_F_REQUEST;
fn->nlmsg_seq = ++filter.rth->seq;
filter.flushp = (((char*)fn) + n->nlmsg_len) - filter.flushb;
filter.flushed++;
filter.flushed = 1;
return 0;
}

View File

@ -32,8 +32,7 @@ extern void incomplete_command(void) ATTRIBUTE_NORETURN;
#define NEXT_ARG() do { if (!*++argv) incomplete_command(); } while (0)
typedef struct
{
typedef struct {
uint8_t family;
uint8_t bytelen;
int16_t bitlen;