The following commit has been merged in the next branch: commit ca6b9b112e07d1ec85aa3c07b080d1f6ebf8cc65 Author: Sven Eckelmann sven.eckelmann@gmx.de Date: Thu Nov 4 14:03:41 2010 +0100
batctl: Remove unused variables
Different variables aren't used after they are set. We can discard them without changing the behavior visible to the outside.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
diff --git a/functions.c b/functions.c index cff8b52..ce046ba 100644 --- a/functions.c +++ b/functions.c @@ -126,7 +126,6 @@ int read_file(char *dir, char *fname, int read_opt, float last_seen; char full_path[500], *buff_ptr, *space_ptr, extra_char; size_t len = 0; - ssize_t read; FILE *fp = NULL;
if (read_opt & USE_BAT_HOSTS) @@ -154,7 +153,7 @@ open: system("clear");
read: - while ((read = getline(&line_ptr, &len, fp)) != -1) { + while (getline(&line_ptr, &len, fp) != -1) { /* the buffer will be handled elsewhere */ if (read_opt & USE_READ_BUFF) break; diff --git a/tcpdump.c b/tcpdump.c index da7e368..7511b40 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -91,7 +91,7 @@ static void dump_arp(unsigned char *packet_buff, ssize_t buff_len, int time_prin LEN_CHECK((size_t)buff_len, sizeof(struct ether_arp), "ARP");
if (!time_printed) - time_printed = print_time(); + print_time();
arphdr = (struct ether_arp *)packet_buff;
@@ -122,7 +122,7 @@ static void dump_ip(unsigned char *packet_buff, ssize_t buff_len, int time_print LEN_CHECK((size_t)buff_len, (size_t)(iphdr->ihl * 4), "IP");
if (!time_printed) - time_printed = print_time(); + print_time();
switch (iphdr->protocol) { case IPPROTO_ICMP: @@ -257,7 +257,7 @@ static void dump_batman_ogm(unsigned char *packet_buff, ssize_t buff_len, int re batman_packet = (struct batman_packet *)(packet_buff + sizeof(struct ether_header));
if (!time_printed) - time_printed = print_time(); + print_time();
printf("BAT %s: ", get_name_by_macaddr((struct ether_addr *)batman_packet->orig, read_opt)); @@ -274,17 +274,15 @@ static void dump_batman_ogm(unsigned char *packet_buff, ssize_t buff_len, int re
static void dump_batman_icmp(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) { - struct ether_header *ether_header; struct icmp_packet *icmp_packet; char *name;
LEN_CHECK((size_t)buff_len - sizeof(struct ether_header), sizeof(struct icmp_packet), "BAT ICMP");
- ether_header = (struct ether_header *)packet_buff; icmp_packet = (struct icmp_packet *)(packet_buff + sizeof(struct ether_header));
if (!time_printed) - time_printed = print_time(); + print_time();
printf("BAT %s > ", get_name_by_macaddr((struct ether_addr *)icmp_packet->orig, read_opt));
@@ -372,13 +370,11 @@ static void dump_batman_bcast(unsigned char *packet_buff, ssize_t buff_len, int
static void dump_batman_frag(unsigned char *packet_buff, ssize_t buff_len, int read_opt, int time_printed) { - struct ether_header *ether_header; struct unicast_frag_packet *unicast_frag_packet;
LEN_CHECK((size_t)buff_len - ETH_HLEN, sizeof(struct unicast_frag_packet), "BAT FRAG"); LEN_CHECK((size_t)buff_len - ETH_HLEN - sizeof(struct unicast_frag_packet), (size_t)ETH_HLEN, "BAT FRAG (unpacked)");
- ether_header = (struct ether_header *)packet_buff; unicast_frag_packet = (struct unicast_frag_packet *)(packet_buff + ETH_HLEN);
if (!time_printed) diff --git a/vis.c b/vis.c index ad612ff..4bc5954 100644 --- a/vis.c +++ b/vis.c @@ -183,7 +183,6 @@ static FILE *open_vis(char *mesh_iface) static int format(char *mesh_iface, const struct funcs *funcs) { size_t len = 0; - ssize_t read; char *line = NULL; char *orig, *from; char *duplet; @@ -202,7 +201,7 @@ static int format(char *mesh_iface, const struct funcs *funcs) if (funcs->print_header) funcs->print_header();
- while ((read = getline(&line, &len, fp)) != -1) { + while (getline(&line, &len, fp) != -1) { /* First MAC address is the originator */ orig = strtok_r(line, ",", &line_save_ptr);