Add a bunch of `const's and fix a typo.

Submitted by: Rich Neswold <rneswold@MCS.Net>
This commit is contained in:
Brian Somers 1999-12-27 11:54:57 +00:00
parent 5b78bdf8aa
commit 182c898a22
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55146
16 changed files with 30 additions and 26 deletions

View File

@ -103,7 +103,7 @@
static int bundle_RemainingIdleTime(struct bundle *);
static const char *PhaseNames[] = {
static const char * const PhaseNames[] = {
"Dead", "Establish", "Authenticate", "Network", "Terminate"
};

View File

@ -142,7 +142,7 @@ cbcp_StartTimer(struct cbcp *cbcp, int timeout)
#define CBCP_RESPSENT (3) /* Waiting for an ACK */
#define CBCP_ACKSENT (4) /* Waiting for an LCP Term REQ */
static const char *cbcpname[] = {
static const char * const cbcpname[] = {
"closed", "stopped", "req-sent", "resp-sent", "ack-sent"
};
@ -209,7 +209,7 @@ cbcp_Output(struct cbcp *cbcp, u_char code, struct cbcp_data *data)
static const char *
cbcp_data_Type(int type)
{
static const char *types[] = {
static const char * const types[] = {
"No callback", "User-spec", "Server-spec", "list"
};

View File

@ -90,10 +90,10 @@ static struct fsm_callbacks ccp_Callbacks = {
CcpRecvResetAck
};
static const char *ccp_TimerNames[] =
static const char * const ccp_TimerNames[] =
{"CCP restart", "CCP openmode", "CCP stopped"};
static char const *cftypes[] = {
static char const * const cftypes[] = {
/* Check out the latest ``Compression Control Protocol'' rfc (rfc1962.txt) */
"OUI", /* 0: OUI */
"PRED1", /* 1: Predictor type 1 */
@ -126,7 +126,7 @@ protoname(int proto)
}
/* We support these algorithms, and Req them in the given order */
static const struct ccp_algorithm *algorithm[] = {
static const struct ccp_algorithm * const algorithm[] = {
&DeflateAlgorithm,
&Pred1Algorithm,
&PppdDeflateAlgorithm

View File

@ -77,7 +77,7 @@
#include "chap_ms.h"
#endif
static const char *chapcodes[] = {
static const char * const chapcodes[] = {
"???", "CHALLENGE", "RESPONSE", "SUCCESS", "FAILURE"
};
#define MAXCHAPCODE (sizeof chapcodes / sizeof chapcodes[0] - 1)

View File

@ -1219,7 +1219,7 @@ datalink_SetRedial(struct cmdargs const *arg)
return -1;
}
static const char *states[] = {
static const char * const states[] = {
"closed",
"opening",
"hangup",

View File

@ -19,7 +19,7 @@
*
* $FreeBSD$
*
* TODO: Shoud send ICMP error message when we discard packets.
* TODO: Should send ICMP error message when we discard packets.
*/
#include <sys/param.h>
@ -533,7 +533,7 @@ filter_Set(struct cmdargs const *arg)
const char *
filter_Action2Nam(int act)
{
static const char *actname[] = { " none ", "permit ", " deny " };
static const char * const actname[] = { " none ", "permit ", " deny " };
static char buf[8];
if (act >= 0 && act < MAXFILTERS) {
@ -618,7 +618,7 @@ filter_Show(struct cmdargs const *arg)
return 0;
}
static const char *protoname[] = {
static const char * const protoname[] = {
"none", "tcp", "udp", "icmp", "ospf", "igmp", "gre"
};
@ -645,7 +645,7 @@ filter_Nam2Proto(int argc, char const *const *argv)
return proto;
}
static const char *opname[] = {"none", "eq", "gt", "lt"};
static const char * const opname[] = {"none", "eq", "gt", "lt"};
const char *
filter_Op2Nam(int op)

View File

@ -103,7 +103,7 @@ Code2Nam(u_int code)
const char *
State2Nam(u_int state)
{
static const char *StateNames[] = {
static const char * const StateNames[] = {
"Initial", "Starting", "Closed", "Stopped", "Closing", "Stopping",
"Req-Sent", "Ack-Rcvd", "Ack-Sent", "Opened",
};
@ -132,7 +132,7 @@ void
fsm_Init(struct fsm *fp, const char *name, u_short proto, int mincode,
int maxcode, int LogLevel, struct bundle *bundle,
struct link *l, const struct fsm_parent *parent,
struct fsm_callbacks *fn, const char *timer_names[3])
struct fsm_callbacks *fn, const char * const timer_names[3])
{
fp->name = name;
fp->proto = proto;

View File

@ -159,7 +159,7 @@ struct fsmconfig {
extern void fsm_Init(struct fsm *, const char *, u_short, int, int, int,
struct bundle *, struct link *, const struct fsm_parent *,
struct fsm_callbacks *, const char *[3]);
struct fsm_callbacks *, const char * const [3]);
extern void fsm_Output(struct fsm *, u_int, u_int, u_char *, int, int);
extern void fsm_Open(struct fsm *);
extern void fsm_Up(struct fsm *);

View File

@ -68,7 +68,9 @@
#include "tun.h"
#include "ip.h"
static const char *TcpFlags[] = { "FIN", "SYN", "RST", "PSH", "ACK", "URG" };
static const char * const TcpFlags[] = {
"FIN", "SYN", "RST", "PSH", "ACK", "URG"
};
static __inline int
PortMatch(int op, u_short pport, u_short rport)

View File

@ -208,7 +208,7 @@ static struct fsm_callbacks ipcp_Callbacks = {
fsm_NullRecvResetAck
};
static const char *cftypes[] = {
static const char * const cftypes[] = {
/* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */
"???",
"IPADDRS", /* 1: IP-Addresses */ /* deprecated */
@ -218,7 +218,7 @@ static const char *cftypes[] = {
#define NCFTYPES (sizeof cftypes/sizeof cftypes[0])
static const char *cftypes128[] = {
static const char * const cftypes128[] = {
/* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */
"???",
"PRIDNS", /* 129: Primary DNS Server Address */
@ -463,7 +463,7 @@ ipcp_Init(struct ipcp *ipcp, struct bundle *bundle, struct link *l,
{
struct hostent *hp;
char name[MAXHOSTNAMELEN];
static const char *timer_names[] =
static const char * const timer_names[] =
{"IPCP restart", "IPCP openmode", "IPCP stopped"};
fsm_Init(&ipcp->fsm, "IPCP", PROTO_IPCP, 1, IPCP_MAXCODE, LogIPCP,

View File

@ -101,10 +101,10 @@ static struct fsm_callbacks lcp_Callbacks = {
fsm_NullRecvResetAck
};
static const char *lcp_TimerNames[] =
static const char * const lcp_TimerNames[] =
{"LCP restart", "LCP openmode", "LCP stopped"};
static const char *cftypes[] = {
static const char * const cftypes[] = {
/* Check out the latest ``Assigned numbers'' rfc (rfc1700.txt) */
"???",
"MRU", /* 1: Maximum-Receive-Unit */

View File

@ -42,7 +42,7 @@
#include "descriptor.h"
#include "prompt.h"
static const char *LogNames[] = {
static const char * const LogNames[] = {
"Async",
"CBCP",
"CCP",

View File

@ -167,7 +167,7 @@ static const char *
ex_desc(int ex)
{
static char num[12]; /* Used immediately if returned */
static const char *desc[] = {
static const char * const desc[] = {
"normal", "start", "sock", "modem", "dial", "dead", "done",
"reboot", "errdead", "hangup", "term", "nodial", "nologin"
};

View File

@ -292,7 +292,7 @@ int
mbuf_Show(struct cmdargs const *arg)
{
int i;
static const char *mbuftype[] = {
static const char * const mbuftype[] = {
"ip in", "ip out", "nat in", "nat out", "mp in", "mp out",
"vj in", "vj out", "icompd in", "icompd out", "compd in", "compd out",
"lqr in", "lqr out", "echo in", "echo out", "proto in", "proto out",

View File

@ -64,7 +64,9 @@
#include "cbcp.h"
#include "datalink.h"
static const char *papcodes[] = { "???", "REQUEST", "SUCCESS", "FAILURE" };
static const char * const papcodes[] = {
"???", "REQUEST", "SUCCESS", "FAILURE"
};
#define MAXPAPCODE (sizeof papcodes / sizeof papcodes[0] - 1)
static void

View File

@ -42,7 +42,7 @@ static void StopTimerNoBlock(struct pppTimer *);
static const char *
tState2Nam(u_int state)
{
static const char *StateNames[] = { "stopped", "running", "expired" };
static const char * const StateNames[] = { "stopped", "running", "expired" };
if (state >= sizeof StateNames / sizeof StateNames[0])
return "unknown";