PPP, adding const pragma to struct protent, saving about 200 bytes in .data segment

This commit is contained in:
Sylvain Rochet 2012-10-13 18:38:18 +02:00
parent a0298728df
commit 9e4aa79278
21 changed files with 31 additions and 31 deletions

View File

@ -52,6 +52,6 @@ extern ccp_options ccp_gotoptions[];
extern ccp_options ccp_allowoptions[];
extern ccp_options ccp_hisoptions[];
extern struct protent ccp_protent;
extern const struct protent ccp_protent;
#endif /* PPP_SUPPORT && CCP_SUPPORT */

View File

@ -192,7 +192,7 @@ extern void chap_auth_peer(ppp_pcb *pcb, char *our_name, int digest_code);
extern void chap_auth_with_peer(ppp_pcb *pcb, char *our_name, int digest_code);
/* Represents the CHAP protocol to the main pppd code */
extern struct protent chap_protent;
extern const struct protent chap_protent;
#endif /* CHAP_H */
#endif /* PPP_SUPPORT && CHAP_SUPPORT */

View File

@ -157,7 +157,7 @@ typedef struct eap_state {
void eap_authwithpeer(ppp_pcb *pcb, char *localname);
void eap_authpeer(ppp_pcb *pcb, char *localname);
extern struct protent eap_protent;
extern const struct protent eap_protent;
#ifdef __cplusplus
}

View File

@ -45,6 +45,6 @@ extern ecp_options ecp_gotoptions[];
extern ecp_options ecp_allowoptions[];
extern ecp_options ecp_hisoptions[];
extern struct protent ecp_protent;
extern const struct protent ecp_protent;
#endif /* PPP_SUPPORT && ECP_SUPPORT */

View File

@ -101,7 +101,7 @@ typedef struct ipcp_options {
char *ip_ntoa (u32_t);
#endif /* UNUSED, already defined by lwIP */
extern struct protent ipcp_protent;
extern const struct protent ipcp_protent;
#endif /* IPCP_H */
#endif /* PPP_SUPPORT */

View File

@ -173,7 +173,7 @@ typedef struct ipv6cp_options {
eui64_t ourid, hisid; /* Interface identifiers */
} ipv6cp_options;
extern struct protent ipv6cp_protent;
extern const struct protent ipv6cp_protent;
#endif /* IPV6CP_H */
#endif /* PPP_SUPPORT && PPP_IPV6_SUPPORT */

View File

@ -164,7 +164,7 @@ void lcp_lowerup(ppp_pcb *pcb);
void lcp_lowerdown(ppp_pcb *pcb);
void lcp_sprotrej(ppp_pcb *pcb, u_char *p, int len); /* send protocol reject */
extern struct protent lcp_protent;
extern const struct protent lcp_protent;
/* Default number of times we receive our magic number from the peer
before deciding the link is looped-back. */

View File

@ -295,7 +295,7 @@ struct protent {
};
/* Table of pointers to supported protocols */
extern struct protent *protocols[];
extern const struct protent* const protocols[];
/* Values for auth_pending, auth_done */

View File

@ -120,7 +120,7 @@ void upap_authwithpeer(ppp_pcb *pcb, char *user, char *password);
void upap_authpeer(ppp_pcb *pcb);
#endif /* PPP_SERVER */
extern struct protent pap_protent;
extern const struct protent pap_protent;
#endif /* UPAP_H */
#endif /* PPP_SUPPORT && PAP_SUPPORT */

View File

@ -709,7 +709,7 @@ void link_down(ppp_pcb *pcb) {
void upper_layers_down(ppp_pcb *pcb) {
int i;
struct protent *protp;
const struct protent *protp;
for (i = 0; (protp = protocols[i]) != NULL; ++i) {
if (!protp->enabled_flag)
@ -735,7 +735,7 @@ void link_established(ppp_pcb *pcb) {
#endif /* PPP_SERVER */
lcp_options *ho = &pcb->lcp_hisoptions;
int i;
struct protent *protp;
const struct protent *protp;
#if PPP_SERVER
int errcode;
#endif /* PPP_SERVER */
@ -908,7 +908,7 @@ static void network_phase(ppp_pcb *pcb) {
void start_networks(ppp_pcb *pcb) {
#if CCP_SUPPORT || ECP_SUPPORT
int i;
struct protent *protp;
const struct protent *protp;
#endif /* CCP_SUPPORT || ECP_SUPPORT */
#if ECP_SUPPORT
int ecp_required;
@ -974,7 +974,7 @@ void start_networks(ppp_pcb *pcb) {
void continue_networks(ppp_pcb *pcb) {
int i;
struct protent *protp;
const struct protent *protp;
/*
* Start the "real" network protocols.

View File

@ -180,7 +180,7 @@ static int ccp_printpkt (u_char *pkt, int len,
#endif /* PRINTPKT_SUPPORT */
static void ccp_datainput (int unit, u_char *pkt, int len);
struct protent ccp_protent = {
const struct protent ccp_protent = {
PPP_CCP,
ccp_init,
ccp_input,

View File

@ -634,7 +634,7 @@ static int chap_print_pkt(unsigned char *p, int plen,
}
#endif /* PRINTPKT_SUPPORT */
struct protent chap_protent = {
const struct protent chap_protent = {
PPP_CHAP,
chap_init,
chap_input,

View File

@ -83,7 +83,7 @@ void
demand_conf()
{
int i;
struct protent *protp;
const struct protent *protp;
/* framemax = lcp_allowoptions[0].mru;
if (framemax < PPP_MRU) */
@ -128,7 +128,7 @@ void
demand_block()
{
int i;
struct protent *protp;
const struct protent *protp;
for (i = 0; (protp = protocols[i]) != NULL; ++i)
if (protp->enabled_flag && protp->demand_conf != NULL)
@ -145,7 +145,7 @@ demand_discard()
{
struct packet *pkt, *nextpkt;
int i;
struct protent *protp;
const struct protent *protp;
for (i = 0; (protp = protocols[i]) != NULL; ++i)
if (protp->enabled_flag && protp->demand_conf != NULL)
@ -171,7 +171,7 @@ void
demand_unblock()
{
int i;
struct protent *protp;
const struct protent *protp;
for (i = 0; (protp = protocols[i]) != NULL; ++i)
if (protp->enabled_flag && protp->demand_conf != NULL)
@ -436,7 +436,7 @@ active_packet(p, len)
int len;
{
int proto, i;
struct protent *protp;
const struct protent *protp;
if (len < PPP_HDRLEN)
return 0;

View File

@ -111,7 +111,7 @@ static int eap_printpkt(u_char *inp, int inlen,
void (*)(void *arg, char *fmt, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */
struct protent eap_protent = {
const struct protent eap_protent = {
PPP_EAP, /* protocol number */
eap_init, /* initialization procedure */
eap_input, /* process a received packet */

View File

@ -99,7 +99,7 @@ static int ecp_printpkt (u_char *pkt, int len,
static void ecp_datainput (int unit, u_char *pkt, int len);
*/
struct protent ecp_protent = {
const struct protent ecp_protent = {
PPP_ECP,
ecp_init,
NULL, /* ecp_input, */

View File

@ -278,7 +278,7 @@ static int ip_active_pkt (u_char *, int);
static void create_resolv (u32_t, u32_t);
#endif /* UNUSED */
struct protent ipcp_protent = {
const struct protent ipcp_protent = {
PPP_IPCP,
ipcp_init,
ipcp_input,

View File

@ -274,7 +274,7 @@ static int ipv6cp_printpkt(u_char *p, int plen,
static int ipv6_active_pkt(u_char *pkt, int len);
#endif /* PPP_DEMAND */
struct protent ipv6cp_protent = {
const struct protent ipv6cp_protent = {
PPP_IPV6CP,
ipv6cp_init,
ipv6cp_input,

View File

@ -272,7 +272,7 @@ static int lcp_printpkt(u_char *p, int plen,
void (*printer) (void *, char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */
struct protent lcp_protent = {
const struct protent lcp_protent = {
PPP_LCP,
lcp_init,
lcp_input,
@ -592,7 +592,7 @@ static int lcp_extcode(fsm *f, int code, int id, u_char *inp, int len) {
*/
static void lcp_rprotrej(fsm *f, u_char *inp, int len) {
int i;
struct protent *protp;
const struct protent *protp;
u_short prot;
#if PPP_PROTOCOLNAME
const char *pname;

View File

@ -152,7 +152,7 @@ int link_stats_valid;
* One entry per supported protocol.
* The last entry must be NULL.
*/
struct protent *protocols[] = {
const struct protent* const protocols[] = {
&lcp_protent,
#if PAP_SUPPORT
&pap_protent,
@ -599,7 +599,7 @@ int ppp_delete(ppp_pcb *pcb) {
/* Set a PPP PCB to its initial state */
static void ppp_clear(ppp_pcb *pcb) {
struct protent *protp;
const struct protent *protp;
int i;
LWIP_ASSERT("pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF", pcb->phase == PHASE_DEAD || pcb->phase == PHASE_HOLDOFF);
@ -769,7 +769,7 @@ void ppp_input(ppp_pcb *pcb, struct pbuf *pb) {
default: {
int i;
struct protent *protp;
const struct protent *protp;
/*
* Upcall the proper protocol input routine.
*/

View File

@ -89,7 +89,7 @@ static void upap_protrej(ppp_pcb *pcb);
static int upap_printpkt(u_char *p, int plen, void (*printer) (void *, char *, ...), void *arg);
#endif /* PRINTPKT_SUPPORT */
struct protent pap_protent = {
const struct protent pap_protent = {
PPP_PAP,
upap_init,
upap_input,

View File

@ -455,7 +455,7 @@ static void ppp_format_packet(u_char *p, int len,
void (*printer) (void *, char *, ...), void *arg) {
int i, n;
u_short proto;
struct protent *protp;
const struct protent *protp;
if (len >= 2) {
GETSHORT(proto, p);