2005-05-06 Paul Jakma <paul@dishone.st>
* (general) extern and static'ification of functions in code and
header.
Cleanup any definitions with unspecified arguments.
Add casts for callback assignments where the callback is defined,
typically, as passing void *, but the function being assigned has
some other pointer type defined as its argument, as gcc complains
about casts from void * to X* via function arguments.
Fix some old K&R style function argument definitions.
Add noreturn gcc attribute to some functions, as appropriate.
Add unused gcc attribute to some functions (eg ones meant to help
while debugging)
Add guard defines to headers which were missing them.
* command.c: (install_node) add const qualifier, still doesnt shut
up the warning though, because of the double pointer.
(cmp_node) ditto
* keychain.c: (key_str2time) Add GET_LONG_RANGE() macro, derived
fromn vty.h ones to fix some of the (long) < 0 warnings.
* thread.c: (various) use thread_empty
(cpu_record_hash_key) should cast to uintptr_t, a stdint.h type
* vty.h: Add VTY_GET_IPV4_ADDRESS and VTY_GET_IPV4_PREFIX so they
removed from ospfd/ospf_vty.h
* zebra.h: Move definition of ZEBRA_PORT to here, to remove
dependence of lib on zebra/zserv.h
diff --git a/lib/if.c b/lib/if.c
index 35fe9ca..a57da35 100644
--- a/lib/if.c
+++ b/lib/if.c
@@ -191,13 +191,13 @@
return NULL;
}
-char *
+const char *
ifindex2ifname (unsigned int index)
{
struct interface *ifp;
return ((ifp = if_lookup_by_index(index)) != NULL) ?
- ifp->name : (char *)"unknown";
+ ifp->name : "unknown";
}
unsigned int
@@ -434,7 +434,7 @@
}
/* For debugging */
-void
+static void
if_dump (struct interface *ifp)
{
struct listnode *node;
@@ -587,7 +587,7 @@
/* Allocate connected structure. */
struct connected *
-connected_new ()
+connected_new (void)
{
struct connected *new = XMALLOC (MTYPE_CONNECTED, sizeof (struct connected));
memset (new, 0, sizeof (struct connected));
@@ -611,7 +611,7 @@
}
/* Print if_addr structure. */
-void
+static void __attribute__ ((unused))
connected_log (struct connected *connected, char *str)
{
struct prefix *p;
@@ -637,7 +637,7 @@
}
/* If two connected address has same prefix return 1. */
-int
+static int
connected_same_prefix (struct prefix *p1, struct prefix *p2)
{
if (p1->family == p2->family)
@@ -767,13 +767,16 @@
}
#endif
+#if 0 /* this route_table of struct connected's is unused
+ * however, it would be good to use a route_table rather than
+ * a list..
+ */
/* Interface looking up by interface's address. */
-
/* Interface's IPv4 address reverse lookup table. */
struct route_table *ifaddr_ipv4_table;
/* struct route_table *ifaddr_ipv6_table; */
-void
+static void
ifaddr_ipv4_add (struct in_addr *ifaddr, struct interface *ifp)
{
struct route_node *rn;
@@ -794,7 +797,7 @@
rn->info = ifp;
}
-void
+static void
ifaddr_ipv4_delete (struct in_addr *ifaddr, struct interface *ifp)
{
struct route_node *rn;
@@ -817,7 +820,7 @@
}
/* Lookup interface by interface's IP address or interface index. */
-struct interface *
+static struct interface *
ifaddr_ipv4_lookup (struct in_addr *addr, unsigned int ifindex)
{
struct prefix_ipv4 p;
@@ -841,13 +844,16 @@
else
return if_lookup_by_index(ifindex);
}
+#endif /* ifaddr_ipv4_table */
/* Initialize interface list. */
void
-if_init ()
+if_init (void)
{
iflist = list_new ();
+#if 0
ifaddr_ipv4_table = route_table_init ();
+#endif /* ifaddr_ipv4_table */
if (iflist) {
iflist->cmp = (int (*)(void *, void *))if_cmp_func;