Use glib memory allocation and free functions

qemu_malloc/qemu_free no longer exist after this commit.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Anthony Liguori 2011-08-20 22:09:37 -05:00
parent 14015304b6
commit 7267c0947d
357 changed files with 1672 additions and 1674 deletions

View file

@ -54,7 +54,7 @@ static SpiceTimer *timer_add(SpiceTimerFunc func, void *opaque)
{
SpiceTimer *timer;
timer = qemu_mallocz(sizeof(*timer));
timer = g_malloc0(sizeof(*timer));
timer->timer = qemu_new_timer_ms(rt_clock, func, opaque);
QTAILQ_INSERT_TAIL(&timers, timer, next);
return timer;
@ -75,7 +75,7 @@ static void timer_remove(SpiceTimer *timer)
qemu_del_timer(timer->timer);
qemu_free_timer(timer->timer);
QTAILQ_REMOVE(&timers, timer, next);
qemu_free(timer);
g_free(timer);
}
struct SpiceWatch {
@ -118,7 +118,7 @@ static SpiceWatch *watch_add(int fd, int event_mask, SpiceWatchFunc func, void *
{
SpiceWatch *watch;
watch = qemu_mallocz(sizeof(*watch));
watch = g_malloc0(sizeof(*watch));
watch->fd = fd;
watch->func = func;
watch->opaque = opaque;
@ -132,7 +132,7 @@ static void watch_remove(SpiceWatch *watch)
{
watch_update_mask(watch, 0);
QTAILQ_REMOVE(&watches, watch, next);
qemu_free(watch);
g_free(watch);
}
#if SPICE_INTERFACE_CORE_MINOR >= 3
@ -148,7 +148,7 @@ static void channel_list_add(SpiceChannelEventInfo *info)
{
ChannelList *item;
item = qemu_mallocz(sizeof(*item));
item = g_malloc0(sizeof(*item));
item->info = info;
QTAILQ_INSERT_TAIL(&channel_list, item, link);
}
@ -162,7 +162,7 @@ static void channel_list_del(SpiceChannelEventInfo *info)
continue;
}
QTAILQ_REMOVE(&channel_list, item, link);
qemu_free(item);
g_free(item);
return;
}
}
@ -510,25 +510,25 @@ void qemu_spice_init(void)
str = qemu_opt_get(opts, "x509-key-file");
if (str) {
x509_key_file = qemu_strdup(str);
x509_key_file = g_strdup(str);
} else {
x509_key_file = qemu_malloc(len);
x509_key_file = g_malloc(len);
snprintf(x509_key_file, len, "%s/%s", x509_dir, X509_SERVER_KEY_FILE);
}
str = qemu_opt_get(opts, "x509-cert-file");
if (str) {
x509_cert_file = qemu_strdup(str);
x509_cert_file = g_strdup(str);
} else {
x509_cert_file = qemu_malloc(len);
x509_cert_file = g_malloc(len);
snprintf(x509_cert_file, len, "%s/%s", x509_dir, X509_SERVER_CERT_FILE);
}
str = qemu_opt_get(opts, "x509-cacert-file");
if (str) {
x509_cacert_file = qemu_strdup(str);
x509_cacert_file = g_strdup(str);
} else {
x509_cacert_file = qemu_malloc(len);
x509_cacert_file = g_malloc(len);
snprintf(x509_cacert_file, len, "%s/%s", x509_dir, X509_CA_CERT_FILE);
}
@ -631,9 +631,9 @@ void qemu_spice_init(void)
qemu_spice_input_init();
qemu_spice_audio_init();
qemu_free(x509_key_file);
qemu_free(x509_cert_file);
qemu_free(x509_cacert_file);
g_free(x509_key_file);
g_free(x509_cert_file);
g_free(x509_cacert_file);
}
int qemu_spice_add_interface(SpiceBaseInstance *sin)