more const

This commit is contained in:
"Vladimir N. Oleynik" 2005-10-20 09:48:28 +00:00
parent 5cf9a03b3f
commit 0fa9deda17

View File

@ -510,7 +510,7 @@ static struct aftype unspec_aftype = {
NULL, NULL,
}; };
static struct aftype *aftypes[] = { static struct aftype * const aftypes[] = {
#if HAVE_AFUNIX #if HAVE_AFUNIX
&unix_aftype, &unix_aftype,
#endif #endif
@ -672,7 +672,7 @@ static void aftrans_def(char *tool, char *argv0, char *dflt)
/* Check our protocol family table for this family. */ /* Check our protocol family table for this family. */
static struct aftype *get_aftype(const char *name) static struct aftype *get_aftype(const char *name)
{ {
struct aftype **afp; struct aftype * const *afp;
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
if (!sVafinit) if (!sVafinit)
@ -694,7 +694,7 @@ static struct aftype *get_aftype(const char *name)
/* Check our protocol family table for this family. */ /* Check our protocol family table for this family. */
static struct aftype *get_afntype(int af) static struct aftype *get_afntype(int af)
{ {
struct aftype **afp; struct aftype * const *afp;
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
if (!sVafinit) if (!sVafinit)
@ -713,7 +713,7 @@ static struct aftype *get_afntype(int af)
/* Check our protocol family table for this family and return its socket */ /* Check our protocol family table for this family and return its socket */
static int get_socket_for_af(int af) static int get_socket_for_af(int af)
{ {
struct aftype **afp; struct aftype * const *afp;
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
if (!sVafinit) if (!sVafinit)
@ -735,7 +735,7 @@ static void print_aflist(int type)
{ {
int count = 0; int count = 0;
char *txt; char *txt;
struct aftype **afp; struct aftype * const *afp;
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
if (!sVafinit) if (!sVafinit)
@ -840,7 +840,7 @@ static int skfd = -1; /* generic raw socket desc. */
static int sockets_open(int family) static int sockets_open(int family)
{ {
struct aftype **aft; struct aftype * const *aft;
int sfd = -1; int sfd = -1;
static int force = -1; static int force = -1;
@ -889,7 +889,7 @@ static int sockets_open(int family)
#ifdef CONFIG_FEATURE_CLEAN_UP #ifdef CONFIG_FEATURE_CLEAN_UP
static void sockets_close(void) static void sockets_close(void)
{ {
struct aftype **aft; struct aftype * const *aft;
for (aft = aftypes; *aft != NULL; aft++) { for (aft = aftypes; *aft != NULL; aft++) {
struct aftype *af = *aft; struct aftype *af = *aft;
if( af->fd != -1 ) { if( af->fd != -1 ) {
@ -1046,13 +1046,13 @@ static char *get_name(char *name, char *p)
/* Lie about the size of the int pointed to for %n. */ /* Lie about the size of the int pointed to for %n. */
#if INT_MAX == LONG_MAX #if INT_MAX == LONG_MAX
static const char *ss_fmt[] = { static const char * const ss_fmt[] = {
"%n%Lu%u%u%u%u%n%n%n%Lu%u%u%u%u%u", "%n%Lu%u%u%u%u%n%n%n%Lu%u%u%u%u%u",
"%Lu%Lu%u%u%u%u%n%n%Lu%Lu%u%u%u%u%u", "%Lu%Lu%u%u%u%u%n%n%Lu%Lu%u%u%u%u%u",
"%Lu%Lu%u%u%u%u%u%u%Lu%Lu%u%u%u%u%u%u" "%Lu%Lu%u%u%u%u%u%u%Lu%Lu%u%u%u%u%u%u"
}; };
#else #else
static const char *ss_fmt[] = { static const char * const ss_fmt[] = {
"%n%Lu%lu%lu%lu%lu%n%n%n%Lu%lu%lu%lu%lu%lu", "%n%Lu%lu%lu%lu%lu%n%n%n%Lu%lu%lu%lu%lu%lu",
"%Lu%Lu%lu%lu%lu%lu%n%n%Lu%Lu%lu%lu%lu%lu%lu", "%Lu%Lu%lu%lu%lu%lu%n%n%Lu%Lu%lu%lu%lu%lu%lu",
"%Lu%Lu%lu%lu%lu%lu%lu%lu%Lu%Lu%lu%lu%lu%lu%lu%lu" "%Lu%Lu%lu%lu%lu%lu%lu%lu%Lu%Lu%lu%lu%lu%lu%lu%lu"
@ -1350,7 +1350,7 @@ static int do_if_fetch(struct interface *ife)
} else { } else {
errmsg = strerror(errno); errmsg = strerror(errno);
} }
bb_error_msg(_("%s: error fetching interface information: %s\n"), bb_error_msg(_("%s: error fetching interface information: %s"),
ife->name, errmsg); ife->name, errmsg);
return -1; return -1;
} }
@ -1369,12 +1369,12 @@ struct hwtype {
int suppress_null_addr; int suppress_null_addr;
}; };
static struct hwtype unspec_hwtype = { static const struct hwtype unspec_hwtype = {
"unspec", "UNSPEC", -1, 0, "unspec", "UNSPEC", -1, 0,
UNSPEC_print, NULL, NULL UNSPEC_print, NULL, NULL
}; };
static struct hwtype loop_hwtype = { static const struct hwtype loop_hwtype = {
"loop", "Local Loopback", ARPHRD_LOOPBACK, 0, "loop", "Local Loopback", ARPHRD_LOOPBACK, 0,
NULL, NULL, NULL NULL, NULL, NULL
}; };
@ -1478,7 +1478,7 @@ static int in_ether(char *bufp, struct sockaddr *sap)
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
static struct hwtype ether_hwtype = { static const struct hwtype ether_hwtype = {
"ether", "Ethernet", ARPHRD_ETHER, ETH_ALEN, "ether", "Ethernet", ARPHRD_ETHER, ETH_ALEN,
pr_ether, NULL /* UNUSED in_ether */ , NULL pr_ether, NULL /* UNUSED in_ether */ , NULL
}; };
@ -1500,7 +1500,7 @@ static int do_ppp(int fd)
} }
#endif /* KEEP_UNUSED */ #endif /* KEEP_UNUSED */
static struct hwtype ppp_hwtype = { static const struct hwtype ppp_hwtype = {
"ppp", "Point-Point Protocol", ARPHRD_PPP, 0, "ppp", "Point-Point Protocol", ARPHRD_PPP, 0,
NULL, NULL, NULL /* UNUSED do_ppp */ , 0 NULL, NULL, NULL /* UNUSED do_ppp */ , 0
}; };
@ -1508,7 +1508,7 @@ static struct hwtype ppp_hwtype = {
#endif /* HAVE_PPP */ #endif /* HAVE_PPP */
static struct hwtype *hwtypes[] = { static const struct hwtype * const hwtypes[] = {
&loop_hwtype, &loop_hwtype,
@ -1685,9 +1685,9 @@ static const char * const if_port_text[] = {
#endif #endif
/* Check our hardware type table for this type. */ /* Check our hardware type table for this type. */
static struct hwtype *get_hwntype(int type) static const struct hwtype *get_hwntype(int type)
{ {
struct hwtype **hwp; const struct hwtype * const *hwp;
#ifdef KEEP_UNUSED #ifdef KEEP_UNUSED
if (!sVhwinit) if (!sVhwinit)
@ -1704,7 +1704,7 @@ static struct hwtype *get_hwntype(int type)
} }
/* return 1 if address is all zeros */ /* return 1 if address is all zeros */
static int hw_null_address(struct hwtype *hw, void *ap) static int hw_null_address(const struct hwtype *hw, void *ap)
{ {
unsigned int i; unsigned int i;
unsigned char *address = (unsigned char *) ap; unsigned char *address = (unsigned char *) ap;
@ -1794,7 +1794,7 @@ static const unsigned short ife_print_flags_mask[] = {
static void ife_print(struct interface *ptr) static void ife_print(struct interface *ptr)
{ {
struct aftype *ap; struct aftype *ap;
struct hwtype *hw; const struct hwtype *hw;
int hf; int hf;
int can_compress = 0; int can_compress = 0;