aboutsummaryrefslogtreecommitdiff
path: root/sim/common
diff options
context:
space:
mode:
Diffstat (limited to 'sim/common')
-rw-r--r--sim/common/ChangeLog26
-rw-r--r--sim/common/hw-alloc.c10
-rw-r--r--sim/common/hw-base.c2
-rw-r--r--sim/common/hw-handles.c4
-rw-r--r--sim/common/hw-instances.c6
-rw-r--r--sim/common/hw-tree.c8
-rw-r--r--sim/common/sim-core.c8
-rw-r--r--sim/common/sim-cpu.c2
-rw-r--r--sim/common/sim-hw.c2
-rw-r--r--sim/common/sim-memopt.c8
-rw-r--r--sim/common/sim-module.c12
-rw-r--r--sim/common/sim-options.c10
-rw-r--r--sim/common/sim-profile.c4
-rw-r--r--sim/common/sim-utils.c8
-rw-r--r--sim/common/sim-utils.h2
-rw-r--r--sim/common/sim-watch.c2
16 files changed, 63 insertions, 51 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index a253937..11f1d34 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,29 @@
+2011-02-14 Mike Frysinger <vapier@gentoo.org>
+
+ * hw-alloc.c (hw_alloc_data): Delete zalloc_p.
+ (hw_zalloc, hw_malloc): Delete zalloc_p reference.
+ (hw_free): Drop zfree logic and always call free.
+ * hw-base.c (hw_delete): Change zfree to free.
+ * hw-handles.c (hw_handle_remove_ihandle): Likewise.
+ (hw_handle_remove_phandle): Likewise.
+ * hw-instances.c (hw_instance_delete): Likewise.
+ * hw-tree.c (parse_reg_property): Likewise.
+ (parse_ranges_property): Likewise.
+ (parse_string_property): Likewise.
+ * sim-core.c (sim_core_uninstall): Likewise.
+ * sim-cpu.c (sim_cpu_free_all): Likewise.
+ * sim-hw.c (sim_hw_uninstall): Likewise.
+ * sim-memopt.c (do_memopt_delete): Likewise.
+ (sim_memory_uninstall): Likewise.
+ * sim-module.c (sim_module_uninstall): Likewise.
+ * sim-options.c (sim_parse_args): Likewise.
+ * sim-profile.c (profile_pc_cleanup): Likewise.
+ (profile_uninstall): Likewise.
+ * sim-watch.c (do_watchpoint_delete): Likewise.
+ * sim-utils.c (zfree): Delete.
+ (sim_state_free): Change zfree to free.
+ * sim-utils.h (zfree): Delete.
+
2011-02-13 Mike Frysinger <vapier@gentoo.org>
* sim-events.h (_sim_events.time_from_event): Change type to signed64.
diff --git a/sim/common/hw-alloc.c b/sim/common/hw-alloc.c
index cb9a52f..7244baa 100644
--- a/sim/common/hw-alloc.c
+++ b/sim/common/hw-alloc.c
@@ -29,7 +29,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
struct hw_alloc_data {
void *alloc;
- int zalloc_p;
struct hw_alloc_data *next;
};
@@ -55,7 +54,6 @@ hw_zalloc (struct hw *me, unsigned long size)
{
struct hw_alloc_data *memory = ZALLOC (struct hw_alloc_data);
memory->alloc = zalloc (size);
- memory->zalloc_p = 1;
memory->next = me->alloc_of_hw;
me->alloc_of_hw = memory;
return memory->alloc;
@@ -66,7 +64,6 @@ hw_malloc (struct hw *me, unsigned long size)
{
struct hw_alloc_data *memory = ZALLOC (struct hw_alloc_data);
memory->alloc = zalloc (size);
- memory->zalloc_p = 0;
memory->next = me->alloc_of_hw;
me->alloc_of_hw = memory;
return memory->alloc;
@@ -85,11 +82,8 @@ hw_free (struct hw *me,
{
struct hw_alloc_data *die = (*memory);
(*memory) = die->next;
- if (die->zalloc_p)
- zfree (die->alloc);
- else
- free (die->alloc);
- zfree (die);
+ free (die->alloc);
+ free (die);
return;
}
}
diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c
index 130475b..364dc4d 100644
--- a/sim/common/hw-base.c
+++ b/sim/common/hw-base.c
@@ -511,7 +511,7 @@ hw_delete (struct hw *me)
delete_hw_alloc_data (me);
/* finally */
- zfree (me);
+ free (me);
}
void
diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
index a9dc925..69d166d 100644
--- a/sim/common/hw-handles.c
+++ b/sim/common/hw-handles.c
@@ -206,7 +206,7 @@ hw_handle_remove_ihandle (struct hw *hw,
{
struct hw_handle_mapping *delete = *current_map;
*current_map = delete->next;
- zfree (delete);
+ free (delete);
return;
}
current_map = &(*current_map)->next;
@@ -227,7 +227,7 @@ hw_handle_remove_phandle (struct hw *hw,
{
struct hw_handle_mapping *delete = *current_map;
*current_map = delete->next;
- zfree (delete);
+ free (delete);
return;
}
current_map = &(*current_map)->next;
diff --git a/sim/common/hw-instances.c b/sim/common/hw-instances.c
index 143ecdf..5d0932b 100644
--- a/sim/common/hw-instances.c
+++ b/sim/common/hw-instances.c
@@ -88,9 +88,9 @@ hw_instance_delete (struct hw_instance *instance)
hw_abort (me, "no delete method");
instance->method->delete(instance);
if (instance->args != NULL)
- zfree (instance->args);
+ free (instance->args);
if (instance->path != NULL)
- zfree (instance->path);
+ free (instance->path);
if (instance->child == NULL)
{
/* only remove leaf nodes */
@@ -116,7 +116,7 @@ hw_instance_delete (struct hw_instance *instance)
instance->child->parent = NULL;
}
cap_remove (me->ihandles, instance);
- zfree (instance);
+ free (instance);
#endif
}
diff --git a/sim/common/hw-tree.c b/sim/common/hw-tree.c
index c23672c..4252b0d7 100644
--- a/sim/common/hw-tree.c
+++ b/sim/common/hw-tree.c
@@ -561,7 +561,7 @@ parse_reg_property (struct hw *current,
hw_add_reg_array_property (current, property_name,
regs, nr_regs);
- zfree (regs);
+ free (regs);
}
@@ -598,7 +598,7 @@ parse_ranges_property (struct hw *current,
/* create it */
hw_add_range_array_property (current, property_name, ranges, nr_ranges);
- zfree (ranges);
+ free (ranges);
}
@@ -750,9 +750,9 @@ parse_string_property (struct hw *current,
while (nr_strings > 0)
{
nr_strings--;
- zfree (strings[nr_strings]);
+ free (strings[nr_strings]);
}
- zfree(strings);
+ free(strings);
}
diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c
index ddae990..b717bd4 100644
--- a/sim/common/sim-core.c
+++ b/sim/common/sim-core.c
@@ -75,9 +75,9 @@ sim_core_uninstall (SIM_DESC sd)
curr = curr->next;
if (tbd->free_buffer != NULL) {
SIM_ASSERT(tbd->buffer != NULL);
- zfree(tbd->free_buffer);
+ free(tbd->free_buffer);
}
- zfree(tbd);
+ free(tbd);
}
core->common.map[map].first = NULL;
}
@@ -424,8 +424,8 @@ sim_core_map_detach (SIM_DESC sd,
sim_core_mapping *dead = (*entry);
(*entry) = dead->next;
if (dead->free_buffer != NULL)
- zfree (dead->free_buffer);
- zfree (dead);
+ free (dead->free_buffer);
+ free (dead);
return;
}
}
diff --git a/sim/common/sim-cpu.c b/sim/common/sim-cpu.c
index 2f8dd81..5eebd99 100644
--- a/sim/common/sim-cpu.c
+++ b/sim/common/sim-cpu.c
@@ -62,7 +62,7 @@ sim_cpu_free_all (SIM_DESC sd)
void
sim_cpu_free (sim_cpu *cpu)
{
- zfree (cpu);
+ free (cpu);
}
/* PC utilities. */
diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c
index 6cb406f..f56e580 100644
--- a/sim/common/sim-hw.c
+++ b/sim/common/sim-hw.c
@@ -320,7 +320,7 @@ static void
sim_hw_uninstall (struct sim_state *sd)
{
hw_tree_delete (STATE_HW (sd)->tree);
- zfree (STATE_HW (sd));
+ free (STATE_HW (sd));
STATE_HW (sd) = NULL;
}
diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c
index 142f3a6..aa5a6c8 100644
--- a/sim/common/sim-memopt.c
+++ b/sim/common/sim-memopt.c
@@ -283,7 +283,7 @@ do_memopt_delete (SIM_DESC sd,
munmap ((*entry)->buffer, (*entry)->munmap_length);
else
#endif
- zfree ((*entry)->buffer);
+ free ((*entry)->buffer);
}
/* delete it and its aliases */
@@ -294,7 +294,7 @@ do_memopt_delete (SIM_DESC sd,
sim_memopt *dead = alias;
alias = alias->alias;
sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
- zfree (dead);
+ free (dead);
}
return SIM_RC_OK;
}
@@ -630,7 +630,7 @@ sim_memory_uninstall (SIM_DESC sd)
munmap ((*entry)->buffer, (*entry)->munmap_length);
else
#endif
- zfree ((*entry)->buffer);
+ free ((*entry)->buffer);
}
/* delete it and its aliases */
@@ -644,7 +644,7 @@ sim_memory_uninstall (SIM_DESC sd)
sim_memopt *dead = alias;
alias = alias->alias;
sim_core_detach (sd, NULL, dead->level, dead->space, dead->addr);
- zfree (dead);
+ free (dead);
}
}
}
diff --git a/sim/common/sim-module.c b/sim/common/sim-module.c
index bb0e2d0..7b19d9d 100644
--- a/sim/common/sim-module.c
+++ b/sim/common/sim-module.c
@@ -228,7 +228,7 @@ sim_module_uninstall (SIM_DESC sd)
for (d = modules->init_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
@@ -238,7 +238,7 @@ sim_module_uninstall (SIM_DESC sd)
for (d = modules->resume_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
@@ -248,7 +248,7 @@ sim_module_uninstall (SIM_DESC sd)
for (d = modules->suspend_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
@@ -258,7 +258,7 @@ sim_module_uninstall (SIM_DESC sd)
for (d = modules->uninstall_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
@@ -268,11 +268,11 @@ sim_module_uninstall (SIM_DESC sd)
for (d = modules->info_list; d != NULL; d = n)
{
n = d->next;
- zfree (d);
+ free (d);
}
}
- zfree (modules);
+ free (modules);
STATE_MODULES (sd) = NULL;
}
diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c
index 8ad71e7..b726987 100644
--- a/sim/common/sim-options.c
+++ b/sim/common/sim-options.c
@@ -669,11 +669,11 @@ sim_parse_args (SIM_DESC sd, char **argv)
}
}
- zfree (long_options);
- zfree (short_options);
- zfree (handlers);
- zfree (opt_cpu);
- zfree (orig_val);
+ free (long_options);
+ free (short_options);
+ free (handlers);
+ free (opt_cpu);
+ free (orig_val);
return result;
}
diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c
index b0b8ce9..9971933 100644
--- a/sim/common/sim-profile.c
+++ b/sim/common/sim-profile.c
@@ -500,7 +500,7 @@ profile_pc_cleanup (SIM_DESC sd)
sim_cpu *cpu = STATE_CPU (sd, n);
PROFILE_DATA *data = CPU_PROFILE_DATA (cpu);
if (PROFILE_PC_COUNT (data) != NULL)
- zfree (PROFILE_PC_COUNT (data));
+ free (PROFILE_PC_COUNT (data));
PROFILE_PC_COUNT (data) = NULL;
if (PROFILE_PC_EVENT (data) != NULL)
sim_events_deschedule (sd, PROFILE_PC_EVENT (data));
@@ -1307,6 +1307,6 @@ profile_uninstall (SIM_DESC sd)
}
if (PROFILE_INSN_COUNT (data) != NULL)
- zfree (PROFILE_INSN_COUNT (data));
+ free (PROFILE_INSN_COUNT (data));
}
}
diff --git a/sim/common/sim-utils.c b/sim/common/sim-utils.c
index 1dbc4fb..c5c8e98 100644
--- a/sim/common/sim-utils.c
+++ b/sim/common/sim-utils.c
@@ -62,12 +62,6 @@ zalloc (unsigned long size)
return xcalloc (1, size);
}
-void
-zfree (void *data)
-{
- free (data);
-}
-
/* Allocate a sim_state struct. */
SIM_DESC
@@ -118,7 +112,7 @@ sim_state_free (SIM_DESC sd)
SIM_STATE_FREE (sd);
#endif
- zfree (sd);
+ free (sd);
}
/* Return a pointer to the cpu data for CPU_NAME, or NULL if not found. */
diff --git a/sim/common/sim-utils.h b/sim/common/sim-utils.h
index 6f1ca3b..5c18843 100644
--- a/sim/common/sim-utils.h
+++ b/sim/common/sim-utils.h
@@ -28,8 +28,6 @@ void *zalloc (unsigned long size);
#define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE))
#define NZALLOC(TYPE,N) (TYPE*)zalloc(sizeof (TYPE) * (N))
-void zfree(void*);
-
/* Turn VALUE into a string with commas. */
char *sim_add_commas (char *, int, unsigned long);
diff --git a/sim/common/sim-watch.c b/sim/common/sim-watch.c
index 022ca13..7f43071 100644
--- a/sim/common/sim-watch.c
+++ b/sim/common/sim-watch.c
@@ -101,7 +101,7 @@ do_watchpoint_delete (SIM_DESC sd,
sim_watch_point *dead = (*entry);
(*entry) = (*entry)->next;
sim_events_deschedule (sd, dead->event);
- zfree (dead);
+ free (dead);
status = SIM_RC_OK;
}
else