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/thread.c b/lib/thread.c
index 2e1dd24..a18db25 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -88,7 +88,7 @@
 static unsigned int
 cpu_record_hash_key (struct cpu_thread_history *a)
 {
-  return (unsigned int) a->func;
+  return (uintptr_t) a->func;
 }
 
 static int 
@@ -98,7 +98,7 @@
   return a->func == b->func;
 }
 
-static void*  
+static void *
 cpu_record_hash_alloc (struct cpu_thread_history *a)
 {
   struct cpu_thread_history *new;
@@ -252,7 +252,7 @@
 }
 
 /* Debug print for thread_master. */
-void
+static void  __attribute__ ((unused))
 thread_master_debug (struct thread_master *m)
 {
   printf ("-----------\n");
@@ -277,8 +277,9 @@
 thread_master_create ()
 {
   if (cpu_record == NULL) 
-    cpu_record = hash_create_size (1011, cpu_record_hash_key, 
-                                   cpu_record_hash_cmp);
+    cpu_record 
+      = hash_create_size (1011, (unsigned int (*) (void *))cpu_record_hash_key, 
+                          (int (*) (void *, void *))cpu_record_hash_cmp);
     
   return (struct thread_master *) XCALLOC (MTYPE_THREAD_MASTER,
 					   sizeof (struct thread_master));
@@ -375,22 +376,22 @@
   XFREE (MTYPE_THREAD_MASTER, m);
 }
 
+/* Thread list is empty or not.  */
+static inline int
+thread_empty (struct thread_list *list)
+{
+  return  list->head ? 0 : 1;
+}
+
 /* Delete top of the list and return it. */
 static struct thread *
 thread_trim_head (struct thread_list *list)
 {
-  if (list->head)
+  if (!thread_empty (list))
     return thread_list_delete (list, list->head);
   return NULL;
 }
 
-/* Thread list is empty or not.  */
-int
-thread_empty (struct thread_list *list)
-{
-  return  list->head ? 0 : 1;
-}
-
 /* Return remain time in second. */
 unsigned long
 thread_timer_remain_second (struct thread *thread)
@@ -437,7 +438,7 @@
 {
   struct thread *thread;
 
-  if (m->unuse.head)
+  if (!thread_empty (&m->unuse))
     {
       thread = thread_trim_head (&m->unuse);
       if (thread->funcname)
@@ -687,7 +688,7 @@
 static struct timeval *
 thread_timer_wait (struct thread_list *tlist, struct timeval *timer_val)
 {
-  if (tlist->head)
+  if (!thread_empty (tlist))
     {
       *timer_val = timeval_subtract (tlist->head->u.sands, recent_time);
       return timer_val;
@@ -695,7 +696,7 @@
   return NULL;
 }
 
-struct thread *
+static struct thread *
 thread_run (struct thread_master *m, struct thread *thread,
 	    struct thread *fetch)
 {
@@ -879,7 +880,8 @@
   
   tmp.func = thread->func;
   tmp.funcname = thread->funcname;
-  cpu = hash_get(cpu_record, &tmp, cpu_record_hash_alloc);
+  cpu = hash_get (cpu_record, &tmp, 
+                  (void * (*) (void *))cpu_record_hash_alloc);
 
   GETRUSAGE (&thread->ru);