2004-10-31 Paul Jakma <paul@dishone.st>

	* memory.h: Add MTYPE_THREAD_FUNCNAME and MTYPE_THREAD_STATS
	* thread.c: Update stats and funcname alloc/free to use previous
	  specific memory type defines
diff --git a/lib/thread.c b/lib/thread.c
index e1625e3..94fdf1f 100644
--- a/lib/thread.c
+++ b/lib/thread.c
@@ -104,10 +104,10 @@
 cpu_record_hash_alloc (struct cpu_thread_history *a)
 {
   struct cpu_thread_history *new;
-  new = XMALLOC( MTYPE_TMP/*XXX*/, sizeof *new);
-  memset(new, 0, sizeof *new);
+  new = XMALLOC( MTYPE_THREAD_STATS, sizeof *new);
+  memset(new, 0, sizeof (struct cpu_thread_history));
   new->func = a->func;
-  new->funcname = XSTRDUP(MTYPE_TMP/*XXX*/,a->funcname);
+  new->funcname = XSTRDUP(MTYPE_THREAD_FUNCNAME, a->funcname);
   return new;
 }
 
@@ -317,6 +317,7 @@
   assert (thread->prev == NULL);
   assert (thread->type == THREAD_UNUSED);
   thread_list_add (&m->unuse, thread);
+  /* XXX: Should we deallocate funcname here? */
 }
 
 /* Free all unused thread. */
@@ -329,7 +330,7 @@
   for (t = list->head; t; t = next)
     {
       next = t->next;
-      XFREE (MTYPE_STRVEC, t->funcname);
+      XFREE (MTYPE_THREAD_FUNCNAME, t->funcname);
       XFREE (MTYPE_THREAD, t);
       list->count--;
       m->alloc--;
@@ -401,7 +402,7 @@
 
   tmp = *e;
   *e = '\0';
-  ret  = XSTRDUP (MTYPE_STRVEC, b);
+  ret  = XSTRDUP (MTYPE_THREAD_FUNCNAME, b);
   *e = tmp;
 
   return ret;
@@ -418,7 +419,7 @@
     {
       thread = thread_trim_head (&m->unuse);
       if (thread->funcname)
-        XFREE(MTYPE_STRVEC, thread->funcname);
+        XFREE(MTYPE_THREAD_FUNCNAME, thread->funcname);
     }
   else
     {
@@ -903,7 +904,7 @@
   dummy.funcname = strip_funcname (funcname);
   thread_call (&dummy);
 
-  XFREE (MTYPE_STRVEC, dummy.funcname);
+  XFREE (MTYPE_THREAD_FUNCNAME, dummy.funcname);
 
   return NULL;
 }