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_rmap.c b/lib/if_rmap.c
index 3f95af3..6730e94 100644
--- a/lib/if_rmap.c
+++ b/lib/if_rmap.c
@@ -30,11 +30,11 @@
struct hash *ifrmaphash;
/* Hook functions. */
-void (*if_rmap_add_hook) (struct if_rmap *) = NULL;
-void (*if_rmap_delete_hook) (struct if_rmap *) = NULL;
+static void (*if_rmap_add_hook) (struct if_rmap *) = NULL;
+static void (*if_rmap_delete_hook) (struct if_rmap *) = NULL;
-struct if_rmap *
-if_rmap_new ()
+static struct if_rmap *
+if_rmap_new (void)
{
struct if_rmap *new;
@@ -43,7 +43,7 @@
return new;
}
-void
+static void
if_rmap_free (struct if_rmap *if_rmap)
{
if (if_rmap->ifname)
@@ -83,18 +83,19 @@
if_rmap_delete_hook = func;
}
-void *
-if_rmap_hash_alloc (struct if_rmap *arg)
+static void *
+if_rmap_hash_alloc (void *arg)
{
+ struct if_rmap *ifarg = arg;
struct if_rmap *if_rmap;
if_rmap = if_rmap_new ();
- if_rmap->ifname = strdup (arg->ifname);
+ if_rmap->ifname = strdup (ifarg->ifname);
return if_rmap;
}
-struct if_rmap *
+static struct if_rmap *
if_rmap_get (const char *ifname)
{
struct if_rmap key;
@@ -105,9 +106,10 @@
return (struct if_rmap *) hash_get (ifrmaphash, &key, if_rmap_hash_alloc);
}
-unsigned int
-if_rmap_hash_make (struct if_rmap *if_rmap)
+static unsigned int
+if_rmap_hash_make (void *data)
{
+ struct if_rmap *if_rmap = data;
unsigned int i, key;
key = 0;
@@ -117,15 +119,17 @@
return key;
}
-int
-if_rmap_hash_cmp (struct if_rmap *if_rmap1, struct if_rmap *if_rmap2)
+static int
+if_rmap_hash_cmp (void *arg1, void* arg2)
{
+ struct if_rmap *if_rmap1 = arg1;
+ struct if_rmap *if_rmap2 = arg2;
if (strcmp (if_rmap1->ifname, if_rmap2->ifname) == 0)
return 1;
return 0;
}
-struct if_rmap *
+static struct if_rmap *
if_rmap_set (const char *ifname, enum if_rmap_type type,
const char *routemap_name)
{
@@ -152,7 +156,7 @@
return if_rmap;
}
-int
+static int
if_rmap_unset (const char *ifname, enum if_rmap_type type,
const char *routemap_name)
{