Message ID | 1332891772-17279-17-git-send-email-joe.hershberger@ni.com |
---|---|
State | Superseded |
Delegated to: | Joe Hershberger |
Headers | show |
On Wed, Mar 28, 2012 at 12:42 PM, Joe Hershberger <joe.hershberger@ni.com>wrote: > x is a poor variable name > > Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> > Cc: Joe Hershberger <joe.hershberger@gmail.com> > Cc: Simon Glass <sjg@chromium.org> > Cc: Mike Frysinger <vapier@gentoo.org> > Acked-by: Simon Glass <sjg@chromium.org> > --- > Changes for v2: > - Split from "Improve variable names and code readability" > > net/net.c | 24 ++++++++++++------------ > 1 files changed, 12 insertions(+), 12 deletions(-) > > diff --git a/net/net.c b/net/net.c > index cac540a..aa1ae05 100644 > --- a/net/net.c > +++ b/net/net.c > @@ -857,9 +857,9 @@ NetReceive(uchar *inpkt, int len) > { > struct Ethernet_hdr *et; > struct IP_UDP_hdr *ip; > - IPaddr_t tmp; > + IPaddr_t dst_ip; > IPaddr_t src_ip; > - int x; > + int eth_proto; > #if defined(CONFIG_CMD_CDP) > int iscdp; > #endif > @@ -894,22 +894,22 @@ NetReceive(uchar *inpkt, int len) > if (mynvlanid == (ushort)-1) > mynvlanid = VLAN_NONE; > > - x = ntohs(et->et_protlen); > + eth_proto = ntohs(et->et_protlen); > > debug("packet received\n"); > > - if (x < 1514) { > + if (eth_proto < 1514) { > struct E802_hdr *et802 = (struct E802_hdr *)et; > /* > * Got a 802.2 packet. Check the other protocol field. > * XXX VLAN over 802.2+SNAP not implemented! > */ > - x = ntohs(et802->et_prot); > + eth_proto = ntohs(et802->et_prot); > > ip = (struct IP_UDP_hdr *)(inpkt + E802_HDR_SIZE); > len -= E802_HDR_SIZE; > > - } else if (x != PROT_VLAN) { /* normal packet */ > + } else if (eth_proto != PROT_VLAN) { /* normal packet */ > ip = (struct IP_UDP_hdr *)(inpkt + ETHER_HDR_SIZE); > len -= ETHER_HDR_SIZE; > > @@ -933,13 +933,13 @@ NetReceive(uchar *inpkt, int len) > > cti = ntohs(vet->vet_tag); > vlanid = cti & VLAN_IDMASK; > - x = ntohs(vet->vet_type); > + eth_proto = ntohs(vet->vet_type); > > ip = (struct IP_UDP_hdr *)(inpkt + VLAN_ETHER_HDR_SIZE); > len -= VLAN_ETHER_HDR_SIZE; > } > > - debug("Receive from protocol 0x%x\n", x); > + debug("Receive from protocol 0x%x\n", eth_proto); > > #if defined(CONFIG_CMD_CDP) > if (iscdp) { > @@ -956,7 +956,7 @@ NetReceive(uchar *inpkt, int len) > return; > } > > - switch (x) { > + switch (eth_proto) { > > case PROT_ARP: > ArpReceive(et, ip, len); > @@ -995,10 +995,10 @@ NetReceive(uchar *inpkt, int len) > return; > } > /* If it is not for us, ignore it */ > - tmp = NetReadIP(&ip->ip_dst); > - if (NetOurIP && tmp != NetOurIP && tmp != 0xFFFFFFFF) { > + dst_ip = NetReadIP(&ip->ip_dst); > + if (NetOurIP && dst_ip != NetOurIP && dst_ip != > 0xFFFFFFFF) { > #ifdef CONFIG_MCAST_TFTP > - if (Mcast_addr != tmp) > + if (Mcast_addr != dst_ip) > #endif > return; > } > -- > 1.6.0.2 > >
diff --git a/net/net.c b/net/net.c index cac540a..aa1ae05 100644 --- a/net/net.c +++ b/net/net.c @@ -857,9 +857,9 @@ NetReceive(uchar *inpkt, int len) { struct Ethernet_hdr *et; struct IP_UDP_hdr *ip; - IPaddr_t tmp; + IPaddr_t dst_ip; IPaddr_t src_ip; - int x; + int eth_proto; #if defined(CONFIG_CMD_CDP) int iscdp; #endif @@ -894,22 +894,22 @@ NetReceive(uchar *inpkt, int len) if (mynvlanid == (ushort)-1) mynvlanid = VLAN_NONE; - x = ntohs(et->et_protlen); + eth_proto = ntohs(et->et_protlen); debug("packet received\n"); - if (x < 1514) { + if (eth_proto < 1514) { struct E802_hdr *et802 = (struct E802_hdr *)et; /* * Got a 802.2 packet. Check the other protocol field. * XXX VLAN over 802.2+SNAP not implemented! */ - x = ntohs(et802->et_prot); + eth_proto = ntohs(et802->et_prot); ip = (struct IP_UDP_hdr *)(inpkt + E802_HDR_SIZE); len -= E802_HDR_SIZE; - } else if (x != PROT_VLAN) { /* normal packet */ + } else if (eth_proto != PROT_VLAN) { /* normal packet */ ip = (struct IP_UDP_hdr *)(inpkt + ETHER_HDR_SIZE); len -= ETHER_HDR_SIZE; @@ -933,13 +933,13 @@ NetReceive(uchar *inpkt, int len) cti = ntohs(vet->vet_tag); vlanid = cti & VLAN_IDMASK; - x = ntohs(vet->vet_type); + eth_proto = ntohs(vet->vet_type); ip = (struct IP_UDP_hdr *)(inpkt + VLAN_ETHER_HDR_SIZE); len -= VLAN_ETHER_HDR_SIZE; } - debug("Receive from protocol 0x%x\n", x); + debug("Receive from protocol 0x%x\n", eth_proto); #if defined(CONFIG_CMD_CDP) if (iscdp) { @@ -956,7 +956,7 @@ NetReceive(uchar *inpkt, int len) return; } - switch (x) { + switch (eth_proto) { case PROT_ARP: ArpReceive(et, ip, len); @@ -995,10 +995,10 @@ NetReceive(uchar *inpkt, int len) return; } /* If it is not for us, ignore it */ - tmp = NetReadIP(&ip->ip_dst); - if (NetOurIP && tmp != NetOurIP && tmp != 0xFFFFFFFF) { + dst_ip = NetReadIP(&ip->ip_dst); + if (NetOurIP && dst_ip != NetOurIP && dst_ip != 0xFFFFFFFF) { #ifdef CONFIG_MCAST_TFTP - if (Mcast_addr != tmp) + if (Mcast_addr != dst_ip) #endif return; }
x is a poor variable name Signed-off-by: Joe Hershberger <joe.hershberger@ni.com> Cc: Joe Hershberger <joe.hershberger@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Mike Frysinger <vapier@gentoo.org> --- Changes for v2: - Split from "Improve variable names and code readability" net/net.c | 24 ++++++++++++------------ 1 files changed, 12 insertions(+), 12 deletions(-)