Skip to contentSkip to conversation

: Shorten variable names in dccp_check_seqno

PATCH Arnaldo Carvalho de Melo 1 participant 1 message Sep 22, 2007

lore
Share & tools
lore
#0 lore raw

Em Sun, Jul 01, 2007 at 03:54:12PM +1200, Ian McDonald escreveu:

Quoted 29 lines · Gerrit Renker
Quoted 18 lines

[DCCP]: Shorten variable names in dccp_check_seqno

This patch is in part required by the next patch; it

* replaces 6 instances of DCCP_SKB_CB(skb)->dccpd_seq' with seqno';
* replaces 7 instances of DCCP_SKB_CB(skb)->dccpd_ack_seq' with ackno';
* replaces 1 use of dccp_inc_seqno() by unfolding `ADD48' macro in place.

No changes in algorithm, all changes are text replacement/substitution.

---
 net/dccp/input.c |   40 +++++++++++++++++-----------------------
 1 file changed, 17 insertions(+), 23 deletions(-)

net/dccp/input.c static int dccp_check_seqno(struct sock · line 73

Quoted 7 lines
net/dccp/input.c +2 -1
@@ -68,7 +68,8 @@ static int dccp_check_seqno(struct sock
 {
        const struct dccp_hdr *dh = dccp_hdr(skb);
        struct dccp_sock *dp = dccp_sk(sk);
-       u64 lswl, lawl;
+       u64 lswl, lawl, seqno = DCCP_SKB_CB(skb)->dccpd_seq,
+                       ackno = DCCP_SKB_CB(skb)->dccpd_ack_seq;
 

I think this would be better served by a macro e.g. #define SEQNO DCCP_SKB_CB(skb)->dccpd_seq

Quoted 2 lines

With the change you're making here you're increasing stack usage by 16 bytes.

But at least in another metric we gain back some bytes, the number of inline expansions is reduced and with that the binary size is shrunk by 65 bytes on 32 bit arches:

[acme@filo net-2.6.24]$ codiff -V /tmp/input.o.before ../build/net-2.6.24/t/net/dccp/input.o /home/acme/git/net-2.6.24/net/dccp/input.c:
dccp_check_seqno | -65 # 1132 -> 1067, # inlines: 7 -> 6, size inlines: 396 -> 360
1 function changed, 65 bytes removed

Humm, codiff should show changes on variables... /me adds it to the TODO list :-)

- Arnaldo