From d79fe0d64301cbe37e2ad0e25a051f8607f08807 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 14 Feb 2011 05:14:28 +0000 Subject: sim: punt zfree() The sim keeps track of which allocations are zero-ed internally (via zalloc) and then calls a helper "zfree" function rather than "free". But this "zfree" function simply calls "free" itself. Since I can see no point in this and it is simply useless overhead, punt it. The only real change is in hw-alloc.c where we remove the zalloc_p tracking, and sim-utils.c where zfree is delete. The rest of the changes are a simple `sed` from "zfree" to "free". Signed-off-by: Mike Frysinger --- sim/common/ChangeLog | 26 ++++++++++++++++++++++++++ sim/common/hw-alloc.c | 10 ++-------- sim/common/hw-base.c | 2 +- sim/common/hw-handles.c | 4 ++-- sim/common/hw-instances.c | 6 +++--- sim/common/hw-tree.c | 8 ++++---- sim/common/sim-core.c | 8 ++++---- sim/common/sim-cpu.c | 2 +- sim/common/sim-hw.c | 2 +- sim/common/sim-memopt.c | 8 ++++---- sim/common/sim-module.c | 12 ++++++------ sim/common/sim-options.c | 10 +++++----- sim/common/sim-profile.c | 4 ++-- sim/common/sim-utils.c | 8 +------- sim/common/sim-utils.h | 2 -- sim/common/sim-watch.c | 2 +- sim/igen/ChangeLog | 4 ++++ sim/igen/table.c | 2 +- sim/iq2000/ChangeLog | 4 ++++ sim/iq2000/iq2000.c | 6 +++--- sim/mips/ChangeLog | 6 ++++++ sim/mips/dv-tx3904sio.c | 4 ++-- sim/mips/interp.c | 6 +++--- sim/ppc/ChangeLog | 39 +++++++++++++++++++++++++++++++++++++++ sim/ppc/cap.c | 2 +- sim/ppc/corefile.c | 4 ++-- sim/ppc/device.c | 24 ++++++++++++------------ sim/ppc/emul_bugapi.c | 4 ++-- sim/ppc/emul_netbsd.c | 8 ++++---- sim/ppc/emul_unix.c | 4 ++-- sim/ppc/events.c | 8 ++++---- sim/ppc/hw_disk.c | 4 ++-- sim/ppc/hw_eeprom.c | 2 +- sim/ppc/hw_htab.c | 2 +- sim/ppc/hw_init.c | 2 +- sim/ppc/hw_memory.c | 6 +++--- sim/ppc/main.c | 6 ------ sim/ppc/pk_disklabel.c | 2 +- sim/ppc/sim_callbacks.h | 2 -- sim/ppc/sim_calls.c | 5 ----- sim/ppc/table.c | 2 +- sim/ppc/tree.c | 8 ++++---- sim/sh64/ChangeLog | 4 ++++ sim/sh64/sh64.c | 6 +++--- sim/v850/ChangeLog | 4 ++++ sim/v850/simops.c | 16 ++++++++-------- 46 files changed, 185 insertions(+), 125 deletions(-) (limited to 'sim') 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 + + * 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 * 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 . */ 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 diff --git a/sim/igen/ChangeLog b/sim/igen/ChangeLog index 0315675..7d1a9b4 100644 --- a/sim/igen/ChangeLog +++ b/sim/igen/ChangeLog @@ -1,3 +1,7 @@ +2011-02-14 Mike Frysinger + + * table.c (table_push): Change zfree to free. + 2009-08-22 Ralf Wildenhues * config.in: Regenerate. diff --git a/sim/igen/table.c b/sim/igen/table.c index a4c60ce..160747a 100644 --- a/sim/igen/table.c +++ b/sim/igen/table.c @@ -131,7 +131,7 @@ table_push (table *root, ff = fopen (dup_name, "rb"); if (ff) break; - /* zfree (dup_name); */ + /* free (dup_name); */ if (include->next == NULL) { if (line != NULL) diff --git a/sim/iq2000/ChangeLog b/sim/iq2000/ChangeLog index 3930787..c25f9031 100644 --- a/sim/iq2000/ChangeLog +++ b/sim/iq2000/ChangeLog @@ -1,3 +1,7 @@ +2011-02-14 Mike Frysinger + + * iq2000.c (do_syscall): Change zfree to free. + 2010-02-11 Doug Evans * cpu.h, * decode.c, * model.c, * sem-switch.c, * sem.c: Regenerate. diff --git a/sim/iq2000/iq2000.c b/sim/iq2000/iq2000.c index 827e406..9dc575e 100644 --- a/sim/iq2000/iq2000.c +++ b/sim/iq2000/iq2000.c @@ -107,7 +107,7 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc) SET_H_GR (ret_reg, sim_io_write (CPU_STATE (current_cpu), PARM1, buf, PARM3)); - zfree (buf); + free (buf); break; case SYS_lseek: @@ -127,7 +127,7 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc) sim_io_read (CPU_STATE (current_cpu), PARM1, buf, PARM3)); sim_write (CPU_STATE (current_cpu), CPU2DATA(PARM2), buf, PARM3); - zfree (buf); + free (buf); break; case SYS_open: @@ -135,7 +135,7 @@ do_syscall (SIM_CPU *current_cpu, PCADDR pc) SET_H_GR (ret_reg, sim_io_open (CPU_STATE (current_cpu), buf, PARM2)); - zfree (buf); + free (buf); break; case SYS_close: diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index 149bded..b19991f 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,9 @@ +2011-02-14 Mike Frysinger + + * dv-tx3904sio.c (tx3904sio_fifo_push): Change zfree to free. + (tx3904sio_fifo_reset): Likewise. + * interp.c (sim_monitor): Likewise. + 2010-04-14 Mike Frysinger * interp.c (sim_write): Add const to buffer arg. diff --git a/sim/mips/dv-tx3904sio.c b/sim/mips/dv-tx3904sio.c index 2156f58..24f0702 100644 --- a/sim/mips/dv-tx3904sio.c +++ b/sim/mips/dv-tx3904sio.c @@ -583,7 +583,7 @@ tx3904sio_fifo_push(struct hw* me, struct tx3904sio_fifo* fifo, char it) char* next_buf = zalloc(next_size); memcpy(next_buf, fifo->buffer, fifo->used); - if(fifo->buffer != NULL) zfree(fifo->buffer); + if(fifo->buffer != NULL) free(fifo->buffer); fifo->buffer = next_buf; fifo->size = next_size; } @@ -599,7 +599,7 @@ tx3904sio_fifo_reset(struct hw* me, struct tx3904sio_fifo* fifo) /* HW_TRACE ((me, "reset fifo")); */ fifo->used = 0; fifo->size = 0; - zfree(fifo->buffer); + free(fifo->buffer); fifo->buffer = 0; } diff --git a/sim/mips/interp.c b/sim/mips/interp.c index a276d06..492ae60 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -1285,7 +1285,7 @@ sim_monitor (SIM_DESC sd, { char *path = fetch_str (sd, A0); V0 = sim_io_open (sd, path, (int)A1); - zfree (path); + free (path); break; } @@ -1296,7 +1296,7 @@ sim_monitor (SIM_DESC sd, char *buf = zalloc (nr); V0 = sim_io_read (sd, fd, buf, nr); sim_write (sd, A1, buf, nr); - zfree (buf); + free (buf); } break; @@ -1311,7 +1311,7 @@ sim_monitor (SIM_DESC sd, sim_io_flush_stdout (sd); else if (fd == 2) sim_io_flush_stderr (sd); - zfree (buf); + free (buf); break; } diff --git a/sim/ppc/ChangeLog b/sim/ppc/ChangeLog index faeec4f..dc059a8 100644 --- a/sim/ppc/ChangeLog +++ b/sim/ppc/ChangeLog @@ -1,3 +1,42 @@ +2011-02-14 Mike Frysinger + + * cap.c (cap_remove): Change zfree to free. + * corefile.c (core_init): Likewise. + * device.c (detach_device_interrupt_edge): Likewise. + (clean_device_interrupt_edges): Likewise. + (device_instance_delete): Likewise. + (device_set_property): Likewise. + (clean_device_properties): Likewise. + (device_add_range_array_property): Likewise. + (device_add_reg_array_property): Likewise. + * emul_bugapi.c (emul_bugapi_do_read): Likewise. + (emul_bugapi_do_write) + * emul_netbsd.c (write_direntries): Likewise. + (do_read): Likewise. + (do_write): Likewise. + (do_getdirentries): Likewise. + * emul_unix.c (do_unix_read): Likewise. + (do_unix_write): Likewise. + * events.c (event_queue_init): Likewise. + (event_queue_deschedule): Likewise. + (event_queue_process): Likewise. + * hw_disk.c (open_disk_image): Likewise. + (hw_disk_instance_delete): Likewise. + * hw_eeprom.c (hw_eeprom_instance_delete): Likewise. + * hw_htab.c (htab_dma_binary): Likewise. + * hw_init.c (update_for_binary_section): Likewise. + * hw_memory.c (hw_memory_set_available): Likewise. + (hw_memory_init_address): Likewise. + (hw_memory_instance_release): Likewise. + * pk_disklabel.c (disklabel_delete): Likewise. + * table.c (table_push): Likewise. + * tree.c (parse_reg_property): Likewise. + (parse_ranges_property): Likewise. + (parse_string_property): Likewise. + * main.c (zfree): Delete. + * sim_calls.c (zfree): Likewise. + * sim_callbacks.h (zfree): Likewise. + 2011-01-11 Andrew Burgess * gdb-sim.c (sim_store_register): Update return value to diff --git a/sim/ppc/cap.c b/sim/ppc/cap.c index a3be304..281429d 100644 --- a/sim/ppc/cap.c +++ b/sim/ppc/cap.c @@ -123,7 +123,7 @@ cap_remove(cap *db, if ((*current_map)->internal == internal) { cap_mapping *delete = *current_map; *current_map = delete->next; - zfree(delete); + free(delete); return; } current_map = &(*current_map)->next; diff --git a/sim/ppc/corefile.c b/sim/ppc/corefile.c index 00295bb..332eefa 100644 --- a/sim/ppc/corefile.c +++ b/sim/ppc/corefile.c @@ -93,9 +93,9 @@ core_init(core *memory) curr = curr->next; if (tbd->free_buffer != NULL) { ASSERT(tbd->buffer != NULL); - zfree(tbd->free_buffer); + free(tbd->free_buffer); } - zfree(tbd); + free(tbd); } map->first = NULL; } diff --git a/sim/ppc/device.c b/sim/ppc/device.c index ffb0943..14b10ce 100644 --- a/sim/ppc/device.c +++ b/sim/ppc/device.c @@ -101,7 +101,7 @@ detach_device_interrupt_edge(device *me, if (old_edge->disposition == permenant_object) device_error(me, "attempt to delete permenant interrupt"); *list = old_edge->next; - zfree(old_edge); + free(old_edge); return; } } @@ -120,7 +120,7 @@ clean_device_interrupt_edges(device_interrupt_edge **list) break; case tempoary_object: *list = old_edge->next; - zfree(old_edge); + free(old_edge); break; } } @@ -590,9 +590,9 @@ device_instance_delete(device_instance *instance) device_error(me, "no delete method"); instance->callback->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 */ device_instance **curr = &me->instances; @@ -614,7 +614,7 @@ device_instance_delete(device_instance *instance) instance->child->parent = NULL; } cap_remove(me->ihandles, instance); - zfree(instance); + free(instance); } INLINE_DEVICE\ @@ -791,7 +791,7 @@ device_set_property(device *me, device_error(me, "conflict between type of new and old value for property %s", property); /* replace its value */ if (value->array != NULL) - zfree((void*)value->array); + free((void*)value->array); new_array = (sizeof_array > 0 ? zalloc(sizeof_array) : (void*)0); @@ -822,7 +822,7 @@ clean_device_properties(device *me) /* zap the current value, will be initialized later */ ASSERT(current->init_array != NULL); if (current->value->array != NULL) { - zfree((void*)current->value->array); + free((void*)current->value->array); current->value->array = NULL; } delete_point = &(*delete_point)->next; @@ -832,9 +832,9 @@ clean_device_properties(device *me) ASSERT(current->init_array == NULL); *delete_point = current->next; if (current->value->array != NULL) - zfree((void*)current->value->array); - zfree(current->value); - zfree(current); + free((void*)current->value->array); + free(current->value); + free(current); break; } } @@ -1239,7 +1239,7 @@ device_add_range_array_property(device *me, cells, sizeof_cells, NULL, permenant_object); - zfree(cells); + free(cells); } INLINE_DEVICE\ @@ -1330,7 +1330,7 @@ device_add_reg_array_property(device *me, cells, sizeof_cells, NULL, permenant_object); - zfree(cells); + free(cells); } INLINE_DEVICE\ diff --git a/sim/ppc/emul_bugapi.c b/sim/ppc/emul_bugapi.c index 9e09d24..7141b35 100644 --- a/sim/ppc/emul_bugapi.c +++ b/sim/ppc/emul_bugapi.c @@ -383,7 +383,7 @@ emul_bugapi_do_read(os_emul_data *bugapi, status--; } - zfree(scratch_buffer); + free(scratch_buffer); return status; } @@ -472,7 +472,7 @@ emul_bugapi_do_write(os_emul_data *bugapi, /* write */ device_instance_write(bugapi->output, scratch_buffer, nbytes); - zfree(scratch_buffer); + free(scratch_buffer); } if (suffix) diff --git a/sim/ppc/emul_netbsd.c b/sim/ppc/emul_netbsd.c index f81c9cb..1a8987f 100644 --- a/sim/ppc/emul_netbsd.c +++ b/sim/ppc/emul_netbsd.c @@ -258,7 +258,7 @@ write_direntries(unsigned_word addr, nbytes -= in->d_reclen; addr += in->d_reclen; buf += in->d_reclen; - zfree(out); + free(out); } } #endif @@ -346,7 +346,7 @@ do_read(os_emul_data *emul, if (status > 0) emul_write_buffer(scratch_buffer, buf, status, processor, cia); - zfree(scratch_buffer); + free(scratch_buffer); } @@ -377,7 +377,7 @@ do_write(os_emul_data *emul, /* write */ status = write(d, scratch_buffer, nbytes); emul_write_status(processor, status, errno); - zfree(scratch_buffer); + free(scratch_buffer); flush_stdoutput(); } @@ -916,7 +916,7 @@ do_getdirentries(os_emul_data *emul, if (status > 0) write_direntries(buf_addr, buf, status, processor, cia); if (buf != NULL) - zfree(buf); + free(buf); } #endif diff --git a/sim/ppc/emul_unix.c b/sim/ppc/emul_unix.c index 0fa5d3f..36738c4 100644 --- a/sim/ppc/emul_unix.c +++ b/sim/ppc/emul_unix.c @@ -240,7 +240,7 @@ do_unix_read(os_emul_data *emul, if (status > 0) emul_write_buffer(scratch_buffer, buf, status, processor, cia); - zfree(scratch_buffer); + free(scratch_buffer); } @@ -270,7 +270,7 @@ do_unix_write(os_emul_data *emul, /* write */ status = write(d, scratch_buffer, nbytes); emul_write_status(processor, status, errno); - zfree(scratch_buffer); + free(scratch_buffer); flush_stdoutput(); } diff --git a/sim/ppc/events.c b/sim/ppc/events.c index 72c9138..ca23687 100644 --- a/sim/ppc/events.c +++ b/sim/ppc/events.c @@ -114,7 +114,7 @@ event_queue_init(event_queue *queue) while (event != NULL) { event_entry *dead = event; event = event->next; - zfree(dead); + free(dead); } queue->held = NULL; queue->held_end = &queue->held; @@ -128,7 +128,7 @@ event_queue_init(event_queue *queue) while (event != NULL) { event_entry *dead = event; event = event->next; - zfree(dead); + free(dead); } queue->queue = NULL; @@ -304,7 +304,7 @@ event_queue_deschedule(event_queue *events, (long)current->time_of_event, (long)current->handler, (long)current->data)); - zfree(current); + free(current); update_time_from_event(events); } else { @@ -392,7 +392,7 @@ event_queue_process(event_queue *events) (long)to_do->time_of_event, (long)handler, (long)data)); - zfree(to_do); + free(to_do); /* Always re-compute the time to the next event so that HANDLER() can safely insert new events into the queue. */ update_time_from_event(events); diff --git a/sim/ppc/hw_disk.c b/sim/ppc/hw_disk.c index 0e9573b..041ed38 100644 --- a/sim/ppc/hw_disk.c +++ b/sim/ppc/hw_disk.c @@ -203,7 +203,7 @@ open_disk_image(device *me, if (disk->image != NULL) fclose(disk->image); if (disk->name != NULL) - zfree(disk->name); + free(disk->name); disk->name = strdup(name); disk->image = fopen(disk->name, disk->read_only ? "r" : "r+"); if (disk->image == NULL) { @@ -351,7 +351,7 @@ hw_disk_instance_delete(device_instance *instance) hw_disk_instance *data = device_instance_data(instance); DITRACE(disk, ("delete - instance=%ld\n", (unsigned long)device_instance_to_external(instance))); - zfree(data); + free(data); } static int diff --git a/sim/ppc/hw_eeprom.c b/sim/ppc/hw_eeprom.c index 5092984..069103b 100644 --- a/sim/ppc/hw_eeprom.c +++ b/sim/ppc/hw_eeprom.c @@ -735,7 +735,7 @@ static void hw_eeprom_instance_delete(device_instance *instance) { hw_eeprom_instance *data = device_instance_data(instance); - zfree(data); + free(data); } static int diff --git a/sim/ppc/hw_htab.c b/sim/ppc/hw_htab.c index 3ad539d..5234f0f 100644 --- a/sim/ppc/hw_htab.c +++ b/sim/ppc/hw_htab.c @@ -486,7 +486,7 @@ htab_dma_binary(bfd *abfd, 1 /*violate_read_only*/) != section_size) device_error(me, "broken dma transfer"); - zfree(section_init); /* only free if load */ + free(section_init); /* only free if load */ } /* create a memory map from a binaries virtual addresses to a copy of diff --git a/sim/ppc/hw_init.c b/sim/ppc/hw_init.c index 118529d..0446774 100644 --- a/sim/ppc/hw_init.c +++ b/sim/ppc/hw_init.c @@ -405,7 +405,7 @@ update_for_binary_section(bfd *abfd, 1 /*violate_read_only*/) != section_size) device_error(me, "broken transfer\n"); - zfree(section_init); /* only free if load */ + free(section_init); /* only free if load */ } } diff --git a/sim/ppc/hw_memory.c b/sim/ppc/hw_memory.c index 117324b..f27f6c8 100644 --- a/sim/ppc/hw_memory.c +++ b/sim/ppc/hw_memory.c @@ -138,7 +138,7 @@ hw_memory_set_available(device *me, } /* update */ device_set_array_property(me, "available", available, sizeof_available); - zfree(available); + free(available); } @@ -155,7 +155,7 @@ hw_memory_init_address(device *me) hw_memory_chunk *dead_chunk = curr_chunk; curr_chunk = dead_chunk->next; dead_chunk->next = NULL; - zfree(dead_chunk); + free(dead_chunk); } } @@ -483,7 +483,7 @@ hw_memory_instance_release(device_instance *instance, ASSERT(chunk->address + chunk->size == delete->address); chunk->size += delete->size; chunk->next = delete->next; - zfree(delete); + free(delete); } else { chunk = chunk->next; diff --git a/sim/ppc/main.c b/sim/ppc/main.c index 554242c..7cb5036 100644 --- a/sim/ppc/main.c +++ b/sim/ppc/main.c @@ -253,12 +253,6 @@ zalloc(long size) return memory; } -void -zfree(void *chunk) -{ - free(chunk); -} - /* When a CNTRL-C occures, queue an event to shut down the simulation */ static RETSIGTYPE diff --git a/sim/ppc/pk_disklabel.c b/sim/ppc/pk_disklabel.c index 91dcf7c..0a9d32a 100644 --- a/sim/ppc/pk_disklabel.c +++ b/sim/ppc/pk_disklabel.c @@ -111,7 +111,7 @@ disklabel_delete(device_instance *instance) { disklabel *label = device_instance_data(instance); device_instance_delete(label->raw_disk); - zfree(label); + free(label); } diff --git a/sim/ppc/sim_callbacks.h b/sim/ppc/sim_callbacks.h index 9fb815b..6f3473d 100644 --- a/sim/ppc/sim_callbacks.h +++ b/sim/ppc/sim_callbacks.h @@ -114,6 +114,4 @@ void *zalloc #define ZALLOC(TYPE) (TYPE*)zalloc(sizeof (TYPE)) -void zfree(void*); - #endif diff --git a/sim/ppc/sim_calls.c b/sim/ppc/sim_calls.c index 276161b..9336516 100644 --- a/sim/ppc/sim_calls.c +++ b/sim/ppc/sim_calls.c @@ -390,8 +390,3 @@ zalloc(long size) memset(memory, 0, size); return memory; } - -void zfree(void *data) -{ - free(data); -} diff --git a/sim/ppc/table.c b/sim/ppc/table.c index db3f783..75bc679 100644 --- a/sim/ppc/table.c +++ b/sim/ppc/table.c @@ -102,7 +102,7 @@ table_push (table *root, fd = open (dup_name, O_RDONLY, 0); if (fd >= 0) break; - /* zfree (dup_name); */ + /* free (dup_name); */ if (include->next == NULL) { error ("Problem opening file `%s'\n", file_name); diff --git a/sim/ppc/tree.c b/sim/ppc/tree.c index 4338cb0..4b14323 100644 --- a/sim/ppc/tree.c +++ b/sim/ppc/tree.c @@ -547,7 +547,7 @@ parse_reg_property(device *current, device_add_reg_array_property(current, property_name, regs, nr_regs); - zfree(regs); + free(regs); } @@ -584,7 +584,7 @@ parse_ranges_property(device *current, /* create it */ device_add_range_array_property(current, property_name, ranges, nr_ranges); - zfree(ranges); + free(ranges); } @@ -770,9 +770,9 @@ parse_string_property(device *current, /* flush the created string */ while (nr_strings > 0) { nr_strings--; - zfree(strings[nr_strings]); + free(strings[nr_strings]); } - zfree(strings); + free(strings); } diff --git a/sim/sh64/ChangeLog b/sim/sh64/ChangeLog index f75d9ad..cc7d5d9 100644 --- a/sim/sh64/ChangeLog +++ b/sim/sh64/ChangeLog @@ -1,3 +1,7 @@ +2011-02-14 Mike Frysinger + + * sh64.c (trap_handler): Change zfree to free. + 2010-10-09 Alan Modra * sh-desc.h: Regenerate. diff --git a/sim/sh64/sh64.c b/sim/sh64/sh64.c index 6c11df8..a4fc445 100644 --- a/sim/sh64/sh64.c +++ b/sim/sh64/sh64.c @@ -594,7 +594,7 @@ trap_handler (SIM_CPU *current_cpu, int shmedia_abi_p, UQI trapnum, PCADDR pc) SET_H_GR (ret_reg, sim_io_write (CPU_STATE (current_cpu), PARM1, buf, PARM3)); - zfree (buf); + free (buf); break; case SYS_lseek: @@ -614,7 +614,7 @@ trap_handler (SIM_CPU *current_cpu, int shmedia_abi_p, UQI trapnum, PCADDR pc) sim_io_read (CPU_STATE (current_cpu), PARM1, buf, PARM3)); sim_write (CPU_STATE (current_cpu), PARM2, buf, PARM3); - zfree (buf); + free (buf); break; case SYS_open: @@ -622,7 +622,7 @@ trap_handler (SIM_CPU *current_cpu, int shmedia_abi_p, UQI trapnum, PCADDR pc) SET_H_GR (ret_reg, sim_io_open (CPU_STATE (current_cpu), buf, PARM2)); - zfree (buf); + free (buf); break; case SYS_close: diff --git a/sim/v850/ChangeLog b/sim/v850/ChangeLog index 5ca0e57..366415a 100644 --- a/sim/v850/ChangeLog +++ b/sim/v850/ChangeLog @@ -1,3 +1,7 @@ +2011-02-14 Mike Frysinger + + * simops.c (OP_10007E0): Change zfree to free. + 2011-01-11 Andrew Burgess * interp.c (sim_store_register): Update return value to diff --git a/sim/v850/simops.c b/sim/v850/simops.c index 49f1200..91315f3 100644 --- a/sim/v850/simops.c +++ b/sim/v850/simops.c @@ -1648,7 +1648,7 @@ OP_10007E0 () char **argv = fetch_argv (simulator, PARM2); char **envp = fetch_argv (simulator, PARM3); RETVAL = execve (path, argv, envp); - zfree (path); + free (path); freeargv (argv); freeargv (envp); break; @@ -1663,7 +1663,7 @@ OP_10007E0 () char *path = fetch_str (simulator, PARM1); char **argv = fetch_argv (simulator, PARM2); RETVAL = execv (path, argv); - zfree (path); + free (path); freeargv (argv); break; } @@ -1706,7 +1706,7 @@ OP_10007E0 () char *buf = zalloc (PARM3); RETVAL = sim_io_read (simulator, PARM1, buf, PARM3); sim_write (simulator, PARM2, buf, PARM3); - zfree (buf); + free (buf); break; } #endif @@ -1720,7 +1720,7 @@ OP_10007E0 () RETVAL = sim_io_write_stdout (simulator, buf, PARM3); else RETVAL = sim_io_write (simulator, PARM1, buf, PARM3); - zfree (buf); + free (buf); break; } #endif @@ -1742,7 +1742,7 @@ OP_10007E0 () { char *buf = fetch_str (simulator, PARM1); RETVAL = sim_io_open (simulator, buf, PARM2); - zfree (buf); + free (buf); break; } #endif @@ -1775,7 +1775,7 @@ OP_10007E0 () RETVAL = stat (path, &host_stat); - zfree (path); + free (path); buf = PARM2; /* Just wild-assed guesses. */ @@ -1801,7 +1801,7 @@ OP_10007E0 () { char *path = fetch_str (simulator, PARM1); RETVAL = chown (path, PARM2, PARM3); - zfree (path); + free (path); } break; #endif @@ -1813,7 +1813,7 @@ OP_10007E0 () { char *path = fetch_str (simulator, PARM1); RETVAL = chmod (path, PARM2); - zfree (path); + free (path); } break; #endif -- cgit v1.1