qemu-malloc.c: Remove qemu-specific heap routines.
Remove all uses of qemu_malloc/malloc0/realloc/free/strdup/etc to use
the equivalent GLib functions (g_malloc, g_free, ...) as per upstream.
This also removes qemu-malloc.c since it's no longer required.
Change-Id: I3c36a0396b73dd114b8da385b43f56a2e54dbb15
diff --git a/vl-android.c b/vl-android.c
index 4054a1c..4b0c991 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -699,7 +699,7 @@
if (vlan->id == id)
return &vlan->net;
}
- vlan = qemu_mallocz(sizeof(struct bt_vlan_s));
+ vlan = g_malloc0(sizeof(struct bt_vlan_s));
vlan->id = id;
pvlan = &first_bt_vlan;
while (*pvlan != NULL)
@@ -1665,7 +1665,7 @@
{
struct pcmcia_socket_entry_s *entry;
- entry = qemu_malloc(sizeof(struct pcmcia_socket_entry_s));
+ entry = g_malloc(sizeof(struct pcmcia_socket_entry_s));
entry->socket = socket;
entry->next = pcmcia_sockets;
pcmcia_sockets = entry;
@@ -1679,7 +1679,7 @@
for (entry = *ptr; entry; ptr = &entry->next, entry = *ptr)
if (entry->socket == socket) {
*ptr = entry->next;
- qemu_free(entry);
+ g_free(entry);
}
}
@@ -1776,7 +1776,7 @@
{
VMChangeStateEntry *e;
- e = qemu_mallocz(sizeof (*e));
+ e = g_malloc0(sizeof (*e));
e->cb = cb;
e->opaque = opaque;
@@ -1787,7 +1787,7 @@
void qemu_del_vm_change_state_handler(VMChangeStateEntry *e)
{
QLIST_REMOVE (e, entries);
- qemu_free (e);
+ g_free (e);
}
void vm_state_notify(int running, int reason)
@@ -1870,7 +1870,7 @@
while (*pre != NULL && (*pre)->order >= order) {
pre = &(*pre)->next;
}
- re = qemu_mallocz(sizeof(QEMUResetEntry));
+ re = g_malloc0(sizeof(QEMUResetEntry));
re->func = func;
re->opaque = opaque;
re->order = order;
@@ -2182,7 +2182,7 @@
p--;
*p = 0;
if (access(buf, R_OK) == 0) {
- return qemu_strdup(buf);
+ return g_strdup(buf);
}
return NULL;
}
@@ -2222,7 +2222,7 @@
}
}
- return qemu_strdup(dirname(buf));
+ return g_strdup(dirname(buf));
}
#endif
@@ -2230,12 +2230,12 @@
qemu_find_file_with_subdir(const char* data_dir, const char* subdir, const char* name)
{
int len = strlen(data_dir) + strlen(name) + strlen(subdir) + 2;
- char* buf = qemu_mallocz(len);
+ char* buf = g_malloc0(len);
snprintf(buf, len, "%s/%s%s", data_dir, subdir, name);
VERBOSE_PRINT(init," trying to find: %s\n", buf);
if (access(buf, R_OK)) {
- qemu_free(buf);
+ g_free(buf);
return NULL;
}
return buf;
@@ -4048,12 +4048,12 @@
if (nb_option_roms >= MAX_OPTION_ROMS) {
PANIC("Too many option ROMs");
}
- option_rom[nb_option_roms] = qemu_strdup(buf);
+ option_rom[nb_option_roms] = g_strdup(buf);
nb_option_roms++;
netroms++;
}
if (filename) {
- qemu_free(filename);
+ g_free(filename);
}
}
}