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/distribute.c b/lib/distribute.c
index 48eb040..3d61621 100644
--- a/lib/distribute.c
+++ b/lib/distribute.c
@@ -35,8 +35,8 @@
void (*distribute_add_hook) (struct distribute *);
void (*distribute_delete_hook) (struct distribute *);
-struct distribute *
-distribute_new ()
+static struct distribute *
+distribute_new (void)
{
struct distribute *new;
@@ -47,7 +47,7 @@
}
/* Free distribute object. */
-void
+static void
distribute_free (struct distribute *dist)
{
if (dist->ifname)
@@ -93,7 +93,7 @@
distribute_delete_hook = func;
}
-void *
+static void *
distribute_hash_alloc (struct distribute *arg)
{
struct distribute *dist;
@@ -107,7 +107,7 @@
}
/* Make new distribute list and push into hash. */
-struct distribute *
+static struct distribute *
distribute_get (const char *ifname)
{
struct distribute key;
@@ -115,10 +115,10 @@
/* temporary reference */
key.ifname = (char *)ifname;
- return hash_get (disthash, &key, distribute_hash_alloc);
+ return hash_get (disthash, &key, (void * (*) (void *))distribute_hash_alloc);
}
-unsigned int
+static unsigned int
distribute_hash_make (struct distribute *dist)
{
unsigned int i, key;
@@ -133,7 +133,7 @@
/* If two distribute-list have same value then return 1 else return
0. This function is used by hash package. */
-int
+static int
distribute_cmp (struct distribute *dist1, struct distribute *dist2)
{
if (dist1->ifname && dist2->ifname)
@@ -145,7 +145,7 @@
}
/* Set access-list name to the distribute list. */
-struct distribute *
+static struct distribute *
distribute_list_set (const char *ifname, enum distribute_type type,
const char *alist_name)
{
@@ -174,7 +174,7 @@
/* Unset distribute-list. If matched distribute-list exist then
return 1. */
-int
+static int
distribute_list_unset (const char *ifname, enum distribute_type type,
const char *alist_name)
{
@@ -223,7 +223,7 @@
}
/* Set access-list name to the distribute list. */
-struct distribute *
+static struct distribute *
distribute_list_prefix_set (const char *ifname, enum distribute_type type,
const char *plist_name)
{
@@ -252,7 +252,7 @@
/* Unset distribute-list. If matched distribute-list exist then
return 1. */
-int
+static int
distribute_list_prefix_unset (const char *ifname, enum distribute_type type,
const char *plist_name)
{
@@ -768,7 +768,8 @@
void
distribute_list_init (int node)
{
- disthash = hash_create (distribute_hash_make, distribute_cmp);
+ disthash = hash_create ((unsigned int (*) (void *)) distribute_hash_make,
+ (int (*) (void *, void *)) distribute_cmp);
if(node==RIP_NODE) {
install_element (RIP_NODE, &distribute_list_all_cmd);