PPP, removed unnecessary memset()

Everything is cleared in ppp_clear(), we don't need to clear all
structures twice.
This commit is contained in:
Sylvain Rochet 2015-04-29 23:55:23 +02:00
parent 40c671b1a5
commit 1b6d6d0dc0
5 changed files with 11 additions and 3 deletions

View File

@ -368,20 +368,19 @@ setdeflate(argv)
static void ccp_init(ppp_pcb *pcb) {
fsm *f = &pcb->ccp_fsm;
ccp_options *wo = &pcb->ccp_wantoptions;
ccp_options *go = &pcb->ccp_gotoptions;
ccp_options *ao = &pcb->ccp_allowoptions;
ccp_options *ho = &pcb->ccp_hisoptions;
f->pcb = pcb;
f->protocol = PPP_CCP;
f->callbacks = &ccp_callbacks;
fsm_init(f);
/* FIXME: useless, everything is cleared in ppp_clear() */
#if 0 /* Not necessary, everything is cleared in ppp_clear() */
memset(wo, 0, sizeof(*wo));
memset(go, 0, sizeof(*go));
memset(ao, 0, sizeof(*ao));
memset(ho, 0, sizeof(*ho));
#endif /* 0 */
#if DEFLATE_SUPPORT
wo->deflate = 1;

View File

@ -122,11 +122,14 @@ static const struct chap_digest_type* const chap_digests[] = {
* chap_init - reset to initial state.
*/
static void chap_init(ppp_pcb *pcb) {
LWIP_UNUSED_ARG(pcb);
#if 0 /* Not necessary, everything is cleared in ppp_clear() */
memset(&pcb->chap_client, 0, sizeof(chap_client_state));
#if PPP_SERVER
memset(&pcb->chap_server, 0, sizeof(chap_server_state));
#endif /* PPP_SERVER */
#endif /* 0 */
}
/*

View File

@ -166,10 +166,12 @@ ecp_init(unit)
f->callbacks = &ecp_callbacks;
fsm_init(f);
#if 0 /* Not necessary, everything is cleared in ppp_clear() */
memset(&ecp_wantoptions[unit], 0, sizeof(ecp_options));
memset(&ecp_gotoptions[unit], 0, sizeof(ecp_options));
memset(&ecp_allowoptions[unit], 0, sizeof(ecp_options));
memset(&ecp_hisoptions[unit], 0, sizeof(ecp_options));
#endif /* 0 */
}

View File

@ -611,8 +611,10 @@ static void ipcp_init(ppp_pcb *pcb) {
*/
f->maxnakloops = 100;
#if 0 /* Not necessary, everything is cleared in ppp_clear() */
memset(wo, 0, sizeof(*wo));
memset(ao, 0, sizeof(*ao));
#endif /* 0 */
wo->neg_addr = wo->old_addrs = 1;
#if VJ_SUPPORT

View File

@ -435,8 +435,10 @@ static void ipv6cp_init(ppp_pcb *pcb) {
f->callbacks = &ipv6cp_callbacks;
fsm_init(f);
#if 0 /* Not necessary, everything is cleared in ppp_clear() */
memset(wo, 0, sizeof(*wo));
memset(ao, 0, sizeof(*ao));
#endif /* 0 */
wo->accept_local = 1;
wo->neg_ifaceid = 1;