diff options
author | Gerrit Renker <gerrit@erg.abdn.ac.uk> | 2007-10-24 08:53:01 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@ghostprotocols.net> | 2007-10-24 08:53:01 -0400 |
commit | 24c667db59a9cc4caaafe4f77f6f4ef85899a454 (patch) | |
tree | 9470e271eb74375c79aad804d7400644e3762cca /net/dccp | |
parent | 76fd1e87d9456c8185b8df76ac5e533e0c8b39bb (diff) |
[CCID2/3]: Initialisation assignments of 0 are redundant
Assigning initial values of `0' is redundant when loading a new CCID structure,
since in net/dccp/ccid.c the entire CCID structure is zeroed out prior to
initialisation in ccid_new():
struct ccid {
struct ccid_operations *ccid_ops;
char ccid_priv[0];
};
// ...
if (rx) {
memset(ccid + 1, 0, ccid_ops->ccid_hc_rx_obj_size);
if (ccid->ccid_ops->ccid_hc_rx_init != NULL &&
ccid->ccid_ops->ccid_hc_rx_init(ccid, sk) != 0)
goto out_free_ccid;
} else {
memset(ccid + 1, 0, ccid_ops->ccid_hc_tx_obj_size);
/* analogous to the rx case */
}
This patch therefore removes the redundant assignments. Thanks to Arnaldo for
the inspiration.
Signed-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>
Signed-off-by: Ian McDonald <ian.mcdonald@jandi.co.nz>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'net/dccp')
-rw-r--r-- | net/dccp/ccids/ccid2.c | 4 | ||||
-rw-r--r-- | net/dccp/ccids/ccid3.c | 4 |
2 files changed, 0 insertions, 8 deletions
diff --git a/net/dccp/ccids/ccid2.c b/net/dccp/ccids/ccid2.c index 426008e3b7e..d694656b880 100644 --- a/net/dccp/ccids/ccid2.c +++ b/net/dccp/ccids/ccid2.c | |||
@@ -750,20 +750,16 @@ static int ccid2_hc_tx_init(struct ccid *ccid, struct sock *sk) | |||
750 | */ | 750 | */ |
751 | hctx->ccid2hctx_ssthresh = ~0; | 751 | hctx->ccid2hctx_ssthresh = ~0; |
752 | hctx->ccid2hctx_numdupack = 3; | 752 | hctx->ccid2hctx_numdupack = 3; |
753 | hctx->ccid2hctx_seqbufc = 0; | ||
754 | 753 | ||
755 | /* XXX init ~ to window size... */ | 754 | /* XXX init ~ to window size... */ |
756 | if (ccid2_hc_tx_alloc_seq(hctx)) | 755 | if (ccid2_hc_tx_alloc_seq(hctx)) |
757 | return -ENOMEM; | 756 | return -ENOMEM; |
758 | 757 | ||
759 | hctx->ccid2hctx_sent = 0; | ||
760 | hctx->ccid2hctx_rto = 3 * HZ; | 758 | hctx->ccid2hctx_rto = 3 * HZ; |
761 | ccid2_change_srtt(hctx, -1); | 759 | ccid2_change_srtt(hctx, -1); |
762 | hctx->ccid2hctx_rttvar = -1; | 760 | hctx->ccid2hctx_rttvar = -1; |
763 | hctx->ccid2hctx_lastrtt = 0; | ||
764 | hctx->ccid2hctx_rpdupack = -1; | 761 | hctx->ccid2hctx_rpdupack = -1; |
765 | hctx->ccid2hctx_last_cong = jiffies; | 762 | hctx->ccid2hctx_last_cong = jiffies; |
766 | hctx->ccid2hctx_high_ack = 0; | ||
767 | 763 | ||
768 | hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire; | 764 | hctx->ccid2hctx_rtotimer.function = &ccid2_hc_tx_rto_expire; |
769 | hctx->ccid2hctx_rtotimer.data = (unsigned long)sk; | 765 | hctx->ccid2hctx_rtotimer.data = (unsigned long)sk; |
diff --git a/net/dccp/ccids/ccid3.c b/net/dccp/ccids/ccid3.c index 05f263e9160..19b33586333 100644 --- a/net/dccp/ccids/ccid3.c +++ b/net/dccp/ccids/ccid3.c | |||
@@ -604,8 +604,6 @@ static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk) | |||
604 | { | 604 | { |
605 | struct ccid3_hc_tx_sock *hctx = ccid_priv(ccid); | 605 | struct ccid3_hc_tx_sock *hctx = ccid_priv(ccid); |
606 | 606 | ||
607 | hctx->ccid3hctx_s = 0; | ||
608 | hctx->ccid3hctx_rtt = 0; | ||
609 | hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; | 607 | hctx->ccid3hctx_state = TFRC_SSTATE_NO_SENT; |
610 | INIT_LIST_HEAD(&hctx->ccid3hctx_hist); | 608 | INIT_LIST_HEAD(&hctx->ccid3hctx_hist); |
611 | 609 | ||
@@ -966,8 +964,6 @@ static int ccid3_hc_rx_init(struct ccid *ccid, struct sock *sk) | |||
966 | INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist); | 964 | INIT_LIST_HEAD(&hcrx->ccid3hcrx_li_hist); |
967 | hcrx->ccid3hcrx_tstamp_last_feedback = | 965 | hcrx->ccid3hcrx_tstamp_last_feedback = |
968 | hcrx->ccid3hcrx_tstamp_last_ack = ktime_get_real(); | 966 | hcrx->ccid3hcrx_tstamp_last_ack = ktime_get_real(); |
969 | hcrx->ccid3hcrx_s = 0; | ||
970 | hcrx->ccid3hcrx_rtt = 0; | ||
971 | return 0; | 967 | return 0; |
972 | } | 968 | } |
973 | 969 | ||