Fix for sim/common hw_delete()/hw_tree_delete()
authorStephane Carrez <stcarrez@nerim.fr>
Sat, 25 Nov 2000 09:18:52 +0000 (09:18 +0000)
committerStephane Carrez <stcarrez@nerim.fr>
Sat, 25 Nov 2000 09:18:52 +0000 (09:18 +0000)
sim/common/ChangeLog
sim/common/hw-alloc.c
sim/common/hw-base.c
sim/common/hw-base.h

index 831e27425cea1be0647587bdfaa30db54df089b3..473bb57e12e704c8663907c5ba1c2ba1e41ed7cd 100644 (file)
@@ -1,3 +1,11 @@
+2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
+
+       * hw-base.c (hw_delete): Don't free base_of_hw since it's freed.
+       (set_hw_delete): Moved the macro as a function.
+       * hw-base.h (set_hw_delete): Declare as external function.
+       * hw-alloc.c (delete_hw_alloc_data): Allow to free the memory
+       allocated using hw_malloc.
+       
 2000-11-24  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
 
        * sim-options.c (sim_parse_args): Free the memory used for
index e64ae82997e5f0effa052817bc64933fda8d1486..5664e9b5e32066276279136c0faffa2367f593c4 100644 (file)
@@ -42,8 +42,6 @@ create_hw_alloc_data (struct hw *me)
 void
 delete_hw_alloc_data (struct hw *me)
 {
-  if (me->alloc_of_hw != NULL)
-    hw_abort (me, "hw-alloc botch");
   while (me->alloc_of_hw != NULL)
     {
       hw_free (me, me->alloc_of_hw->alloc);
index a13ac64ba3b6e25dfe0f2bc3f9462203a8b23fc7..9c05da81159854297ad54352cb25bd9f973450d0 100644 (file)
@@ -510,10 +510,15 @@ hw_delete (struct hw *me)
   delete_hw_alloc_data (me);
 
   /* finally */
-  zfree (me->base_of_hw);
   zfree (me);
 }
 
+void
+set_hw_delete (struct hw *hw, hw_delete_callback method)
+{
+  hw->base_of_hw->to_delete = method;
+}
+
 
 /* Go through the devices various reg properties for those that
    specify attach addresses */
index d6452d1b3891acc1901a5150e02abc1797db830a..57601034a7c719c69be4f0d09ddd470d9c38c509 100644 (file)
@@ -54,8 +54,7 @@ void hw_delete
 typedef void (hw_delete_callback)
      (struct hw *me);
 
-#define set_hw_delete(hw, method) \
-((hw)->base_of_hw->to_delete = (method))
+extern void set_hw_delete(struct hw* hw, hw_delete_callback method);
 
 
 /* ALLOC */
This page took 0.028792 seconds and 4 git commands to generate.