removed pcb->num if PPP debug is not compiled

This commit is contained in:
Sylvain Rochet 2012-06-19 22:08:14 +02:00
parent eadd56a376
commit b21cb8a396
2 changed files with 15 additions and 4 deletions

View File

@ -122,6 +122,12 @@
#include "netif/ppp_oe.h" #include "netif/ppp_oe.h"
#endif /* PPPOE_SUPPORT */ #endif /* PPPOE_SUPPORT */
/* Global variables */
#if PPP_DEBUG
u8_t ppp_num; /* PPP Interface counter, used for debugging messages */
#endif /* PPP_DEBUG */
/*************************/ /*************************/
/*** LOCAL DEFINITIONS ***/ /*** LOCAL DEFINITIONS ***/
/*************************/ /*************************/
@ -223,7 +229,7 @@ int ppp_init(void) {
} }
/* Create a new PPP session. */ /* Create a new PPP session. */
ppp_pcb *ppp_new(u8_t num) { ppp_pcb *ppp_new(void) {
int i; int i;
ppp_pcb *pcb; ppp_pcb *pcb;
struct protent *protp; struct protent *protp;
@ -237,7 +243,9 @@ ppp_pcb *ppp_new(u8_t num) {
#endif /* PPP_STATS_SUPPORT */ #endif /* PPP_STATS_SUPPORT */
memset(pcb, 0, sizeof(ppp_pcb)); memset(pcb, 0, sizeof(ppp_pcb));
pcb->num = num; #if PPP_DEBUG
pcb->num = ppp_num++;
#endif /* PPP_DEBUG */
pcb->lcp_loopbackfail = DEFLOOPBACKFAIL; pcb->lcp_loopbackfail = DEFLOOPBACKFAIL;
new_phase(pcb, PHASE_INITIALIZE); new_phase(pcb, PHASE_INITIALIZE);
@ -1141,8 +1149,9 @@ ppp_ioctl(ppp_pcb *pcb, int cmd, void *arg)
/* FIXME: improve that */ /* FIXME: improve that */
int ppp_write_pbuf(ppp_pcb *pcb, struct pbuf *p) { int ppp_write_pbuf(ppp_pcb *pcb, struct pbuf *p) {
ppp_write(pcb, p->payload, p->len); int ret = ppp_write(pcb, p->payload, p->len);
pbuf_free(p); pbuf_free(p);
return ret;
} }
/* /*

View File

@ -269,7 +269,9 @@ typedef struct ppp_pcb_rx_s {
*/ */
struct ppp_pcb_s { struct ppp_pcb_s {
ppp_settings settings; ppp_settings settings;
#if PPP_DEBUG
u8_t num; /* Interface number - only useful for debugging */ u8_t num; /* Interface number - only useful for debugging */
#endif /* PPP_DEBUG */
#if PPPOS_SUPPORT #if PPPOS_SUPPORT
ppp_pcb_rx rx; ppp_pcb_rx rx;
#endif /* PPPOS_SUPPORT */ #endif /* PPPOS_SUPPORT */
@ -363,7 +365,7 @@ struct ppp_pcb_s {
int ppp_init(void); int ppp_init(void);
/* Create a new PPP session, returns a PPP PCB structure. */ /* Create a new PPP session, returns a PPP PCB structure. */
ppp_pcb *ppp_new(u8_t num); ppp_pcb *ppp_new(void);
/* Set auth helper, optional, you can either fill ppp_pcb->settings. */ /* Set auth helper, optional, you can either fill ppp_pcb->settings. */