mirror of
https://github.com/lwip-tcpip/lwip.git
synced 2024-10-06 06:39:46 +00:00
PPP, PPPoS: use offsetof in place of the traditional NULL hack
There is absolutely no reason I did it this way in the first place, maybe I feared that not all compilers have a proper implementation of offsetof() ? It sounds stupid.
This commit is contained in:
parent
06782c699c
commit
7c368b7f36
@ -35,6 +35,7 @@
|
|||||||
#if PPP_SUPPORT && PPPOS_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
#if PPP_SUPPORT && PPPOS_SUPPORT /* don't build if not configured for use in lwipopts.h */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stddef.h>
|
||||||
|
|
||||||
#include "lwip/err.h"
|
#include "lwip/err.h"
|
||||||
#include "lwip/pbuf.h"
|
#include "lwip/pbuf.h"
|
||||||
@ -310,7 +311,7 @@ pppos_connect(ppp_pcb *ppp, void *ctx)
|
|||||||
|
|
||||||
ppp_link_start(ppp);
|
ppp_link_start(ppp);
|
||||||
/* reset PPPoS control block to its initial state */
|
/* reset PPPoS control block to its initial state */
|
||||||
memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - ( (char*)&((pppos_pcb*)0)->last_xmit - (char*)0 ) );
|
memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - offsetof(pppos_pcb, last_xmit));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default the in and out accm so that escape and flag characters
|
* Default the in and out accm so that escape and flag characters
|
||||||
@ -344,7 +345,7 @@ pppos_listen(ppp_pcb *ppp, void *ctx)
|
|||||||
|
|
||||||
ppp_link_start(ppp);
|
ppp_link_start(ppp);
|
||||||
/* reset PPPoS control block to its initial state */
|
/* reset PPPoS control block to its initial state */
|
||||||
memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - ( (char*)&((pppos_pcb*)0)->last_xmit - (char*)0 ) );
|
memset(&pppos->last_xmit, 0, sizeof(pppos_pcb) - offsetof(pppos_pcb, last_xmit));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default the in and out accm so that escape and flag characters
|
* Default the in and out accm so that escape and flag characters
|
||||||
|
Loading…
Reference in New Issue
Block a user