aboutsummaryrefslogtreecommitdiff
path: root/sim/ppc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-02-14 05:14:28 +0000
committerMike Frysinger <vapier@gentoo.org>2011-02-14 05:14:28 +0000
commitd79fe0d64301cbe37e2ad0e25a051f8607f08807 (patch)
tree5cbd06fb7eeda4b6d395f2180572fbf2cdceeb68 /sim/ppc
parent891e7fb179daec94b56e4a740f645e8685dee8e5 (diff)
downloadgdb-d79fe0d64301cbe37e2ad0e25a051f8607f08807.zip
gdb-d79fe0d64301cbe37e2ad0e25a051f8607f08807.tar.gz
gdb-d79fe0d64301cbe37e2ad0e25a051f8607f08807.tar.bz2
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 <vapier@gentoo.org>
Diffstat (limited to 'sim/ppc')
-rw-r--r--sim/ppc/ChangeLog39
-rw-r--r--sim/ppc/cap.c2
-rw-r--r--sim/ppc/corefile.c4
-rw-r--r--sim/ppc/device.c24
-rw-r--r--sim/ppc/emul_bugapi.c4
-rw-r--r--sim/ppc/emul_netbsd.c8
-rw-r--r--sim/ppc/emul_unix.c4
-rw-r--r--sim/ppc/events.c8
-rw-r--r--sim/ppc/hw_disk.c4
-rw-r--r--sim/ppc/hw_eeprom.c2
-rw-r--r--sim/ppc/hw_htab.c2
-rw-r--r--sim/ppc/hw_init.c2
-rw-r--r--sim/ppc/hw_memory.c6
-rw-r--r--sim/ppc/main.c6
-rw-r--r--sim/ppc/pk_disklabel.c2
-rw-r--r--sim/ppc/sim_callbacks.h2
-rw-r--r--sim/ppc/sim_calls.c5
-rw-r--r--sim/ppc/table.c2
-rw-r--r--sim/ppc/tree.c8
19 files changed, 80 insertions, 54 deletions
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 <vapier@gentoo.org>
+
+ * 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 <aburgess@broadcom.com>
* 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);
}