summaryrefslogtreecommitdiff
path: root/audio
diff options
context:
space:
mode:
authorAnthony Liguori <aliguori@us.ibm.com>2011-08-20 22:09:37 -0500
committerAnthony Liguori <aliguori@us.ibm.com>2011-08-20 23:01:08 -0500
commit7267c0947d7e8ae5dff7bafd932c3bc285f43e5c (patch)
tree9aa05d6e05ed83e67bf014f6745a3081b8407dc5 /audio
parent14015304b662e8f8ccce46c5a6927af6a14c510b (diff)
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>
Diffstat (limited to 'audio')
-rw-r--r--audio/alsaaudio.c10
-rw-r--r--audio/audio.c30
-rw-r--r--audio/audio_template.h20
-rw-r--r--audio/esdaudio.c8
-rw-r--r--audio/mixeng.c2
-rw-r--r--audio/ossaudio.c4
-rw-r--r--audio/paaudio.c8
-rw-r--r--audio/wavaudio.c4
-rw-r--r--audio/wavcapture.c12
-rw-r--r--audio/winwaveaudio.c16
10 files changed, 57 insertions, 57 deletions
diff --git a/audio/alsaaudio.c b/audio/alsaaudio.c
index 4d720146df..cb45b49c2a 100644
--- a/audio/alsaaudio.c
+++ b/audio/alsaaudio.c
@@ -136,7 +136,7 @@ static void alsa_fini_poll (struct pollhlp *hlp)
for (i = 0; i < hlp->count; ++i) {
qemu_set_fd_handler (pfds[i].fd, NULL, NULL, NULL);
}
- qemu_free (pfds);
+ g_free (pfds);
}
hlp->pfds = NULL;
hlp->count = 0;
@@ -260,7 +260,7 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct pollhlp *hlp, int mask)
if (err < 0) {
alsa_logerr (err, "Could not initialize poll mode\n"
"Could not obtain poll descriptors\n");
- qemu_free (pfds);
+ g_free (pfds);
return -1;
}
@@ -288,7 +288,7 @@ static int alsa_poll_helper (snd_pcm_t *handle, struct pollhlp *hlp, int mask)
while (i--) {
qemu_set_fd_handler (pfds[i].fd, NULL, NULL, NULL);
}
- qemu_free (pfds);
+ g_free (pfds);
return -1;
}
}
@@ -816,7 +816,7 @@ static void alsa_fini_out (HWVoiceOut *hw)
alsa_anal_close (&alsa->handle, &alsa->pollhlp);
if (alsa->pcm_buf) {
- qemu_free (alsa->pcm_buf);
+ g_free (alsa->pcm_buf);
alsa->pcm_buf = NULL;
}
}
@@ -979,7 +979,7 @@ static void alsa_fini_in (HWVoiceIn *hw)
alsa_anal_close (&alsa->handle, &alsa->pollhlp);
if (alsa->pcm_buf) {
- qemu_free (alsa->pcm_buf);
+ g_free (alsa->pcm_buf);
alsa->pcm_buf = NULL;
}
}
diff --git a/audio/audio.c b/audio/audio.c
index 50d2b6438c..5649075b01 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -196,7 +196,7 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size)
return NULL;
}
- return qemu_mallocz (len);
+ return g_malloc0 (len);
}
static char *audio_alloc_prefix (const char *s)
@@ -210,7 +210,7 @@ static char *audio_alloc_prefix (const char *s)
}
len = strlen (s);
- r = qemu_malloc (len + sizeof (qemu_prefix));
+ r = g_malloc (len + sizeof (qemu_prefix));
u = r + sizeof (qemu_prefix) - 1;
@@ -425,7 +425,7 @@ static void audio_print_options (const char *prefix,
printf (" %s\n", opt->descr);
}
- qemu_free (uprefix);
+ g_free (uprefix);
}
static void audio_process_options (const char *prefix,
@@ -462,7 +462,7 @@ static void audio_process_options (const char *prefix,
* (includes trailing zero) + zero + underscore (on behalf of
* sizeof) */
optlen = len + preflen + sizeof (qemu_prefix) + 1;
- optname = qemu_malloc (optlen);
+ optname = g_malloc (optlen);
pstrcpy (optname, optlen, qemu_prefix);
@@ -507,7 +507,7 @@ static void audio_process_options (const char *prefix,
opt->overriddenp = &opt->overridden;
}
*opt->overriddenp = !def;
- qemu_free (optname);
+ g_free (optname);
}
}
@@ -778,7 +778,7 @@ static void audio_detach_capture (HWVoiceOut *hw)
QLIST_REMOVE (sw, entries);
QLIST_REMOVE (sc, entries);
- qemu_free (sc);
+ g_free (sc);
if (was_active) {
/* We have removed soft voice from the capture:
this might have changed the overall status of the capture
@@ -818,7 +818,7 @@ static int audio_attach_capture (HWVoiceOut *hw)
sw->rate = st_rate_start (sw->info.freq, hw_cap->info.freq);
if (!sw->rate) {
dolog ("Could not start rate conversion for `%s'\n", SW_NAME (sw));
- qemu_free (sw);
+ g_free (sw);
return -1;
}
QLIST_INSERT_HEAD (&hw_cap->sw_head, sw, entries);
@@ -1907,7 +1907,7 @@ static void audio_init (void)
void AUD_register_card (const char *name, QEMUSoundCard *card)
{
audio_init ();
- card->name = qemu_strdup (name);
+ card->name = g_strdup (name);
memset (&card->entries, 0, sizeof (card->entries));
QLIST_INSERT_HEAD (&glob_audio_state.card_head, card, entries);
}
@@ -1915,7 +1915,7 @@ void AUD_register_card (const char *name, QEMUSoundCard *card)
void AUD_remove_card (QEMUSoundCard *card)
{
QLIST_REMOVE (card, entries);
- qemu_free (card->name);
+ g_free (card->name);
}
@@ -2000,11 +2000,11 @@ CaptureVoiceOut *AUD_add_capture (
return cap;
err3:
- qemu_free (cap->hw.mix_buf);
+ g_free (cap->hw.mix_buf);
err2:
- qemu_free (cap);
+ g_free (cap);
err1:
- qemu_free (cb);
+ g_free (cb);
err0:
return NULL;
}
@@ -2018,7 +2018,7 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
if (cb->opaque == cb_opaque) {
cb->ops.destroy (cb_opaque);
QLIST_REMOVE (cb, entries);
- qemu_free (cb);
+ g_free (cb);
if (!cap->cb_head.lh_first) {
SWVoiceOut *sw = cap->hw.sw_head.lh_first, *sw1;
@@ -2036,11 +2036,11 @@ void AUD_del_capture (CaptureVoiceOut *cap, void *cb_opaque)
}
QLIST_REMOVE (sw, entries);
QLIST_REMOVE (sc, entries);
- qemu_free (sc);
+ g_free (sc);
sw = sw1;
}
QLIST_REMOVE (cap, entries);
- qemu_free (cap);
+ g_free (cap);
}
return;
}
diff --git a/audio/audio_template.h b/audio/audio_template.h
index fd4469e638..e62a71345e 100644
--- a/audio/audio_template.h
+++ b/audio/audio_template.h
@@ -72,7 +72,7 @@ static void glue (audio_init_nb_voices_, TYPE) (struct audio_driver *drv)
static void glue (audio_pcm_hw_free_resources_, TYPE) (HW *hw)
{
if (HWBUF) {
- qemu_free (HWBUF);
+ g_free (HWBUF);
}
HWBUF = NULL;
@@ -93,7 +93,7 @@ static int glue (audio_pcm_hw_alloc_resources_, TYPE) (HW *hw)
static void glue (audio_pcm_sw_free_resources_, TYPE) (SW *sw)
{
if (sw->buf) {
- qemu_free (sw->buf);
+ g_free (sw->buf);
}
if (sw->rate) {
@@ -123,7 +123,7 @@ static int glue (audio_pcm_sw_alloc_resources_, TYPE) (SW *sw)
sw->rate = st_rate_start (sw->hw->info.freq, sw->info.freq);
#endif
if (!sw->rate) {
- qemu_free (sw->buf);
+ g_free (sw->buf);
sw->buf = NULL;
return -1;
}
@@ -160,10 +160,10 @@ static int glue (audio_pcm_sw_init_, TYPE) (
[sw->info.swap_endianness]
[audio_bits_to_index (sw->info.bits)];
- sw->name = qemu_strdup (name);
+ sw->name = g_strdup (name);
err = glue (audio_pcm_sw_alloc_resources_, TYPE) (sw);
if (err) {
- qemu_free (sw->name);
+ g_free (sw->name);
sw->name = NULL;
}
return err;
@@ -173,7 +173,7 @@ static void glue (audio_pcm_sw_fini_, TYPE) (SW *sw)
{
glue (audio_pcm_sw_free_resources_, TYPE) (sw);
if (sw->name) {
- qemu_free (sw->name);
+ g_free (sw->name);
sw->name = NULL;
}
}
@@ -201,7 +201,7 @@ static void glue (audio_pcm_hw_gc_, TYPE) (HW **hwp)
glue (s->nb_hw_voices_, TYPE) += 1;
glue (audio_pcm_hw_free_resources_ ,TYPE) (hw);
glue (hw->pcm_ops->fini_, TYPE) (hw);
- qemu_free (hw);
+ g_free (hw);
*hwp = NULL;
}
}
@@ -300,7 +300,7 @@ static HW *glue (audio_pcm_hw_add_new_, TYPE) (struct audsettings *as)
err1:
glue (hw->pcm_ops->fini_, TYPE) (hw);
err0:
- qemu_free (hw);
+ g_free (hw);
return NULL;
}
@@ -368,7 +368,7 @@ err3:
glue (audio_pcm_hw_del_sw_, TYPE) (sw);
glue (audio_pcm_hw_gc_, TYPE) (&hw);
err2:
- qemu_free (sw);
+ g_free (sw);
err1:
return NULL;
}
@@ -378,7 +378,7 @@ static void glue (audio_close_, TYPE) (SW *sw)
glue (audio_pcm_sw_fini_, TYPE) (sw);
glue (audio_pcm_hw_del_sw_, TYPE) (sw);
glue (audio_pcm_hw_gc_, TYPE) (&sw->hw);
- qemu_free (sw);
+ g_free (sw);
}
void glue (AUD_close_, TYPE) (QEMUSoundCard *card, SW *sw)
diff --git a/audio/esdaudio.c b/audio/esdaudio.c
index ff97b397d2..bd6e1cc19b 100644
--- a/audio/esdaudio.c
+++ b/audio/esdaudio.c
@@ -246,7 +246,7 @@ static int qesd_init_out (HWVoiceOut *hw, struct audsettings *as)
esd->fd = -1;
fail1:
- qemu_free (esd->pcm_buf);
+ g_free (esd->pcm_buf);
esd->pcm_buf = NULL;
return -1;
}
@@ -270,7 +270,7 @@ static void qesd_fini_out (HWVoiceOut *hw)
audio_pt_fini (&esd->pt, AUDIO_FUNC);
- qemu_free (esd->pcm_buf);
+ g_free (esd->pcm_buf);
esd->pcm_buf = NULL;
}
@@ -453,7 +453,7 @@ static int qesd_init_in (HWVoiceIn *hw, struct audsettings *as)
esd->fd = -1;
fail1:
- qemu_free (esd->pcm_buf);
+ g_free (esd->pcm_buf);
esd->pcm_buf = NULL;
return -1;
}
@@ -477,7 +477,7 @@ static void qesd_fini_in (HWVoiceIn *hw)
audio_pt_fini (&esd->pt, AUDIO_FUNC);
- qemu_free (esd->pcm_buf);
+ g_free (esd->pcm_buf);
esd->pcm_buf = NULL;
}
diff --git a/audio/mixeng.c b/audio/mixeng.c
index 4a9e8ebe2a..5446be674f 100644
--- a/audio/mixeng.c
+++ b/audio/mixeng.c
@@ -326,7 +326,7 @@ void *st_rate_start (int inrate, int outrate)
void st_rate_stop (void *opaque)
{
- qemu_free (opaque);
+ g_free (opaque);
}
void mixeng_clear (struct st_sample *buf, int len)
diff --git a/audio/ossaudio.c b/audio/ossaudio.c
index b49e102747..df51b7cc58 100644
--- a/audio/ossaudio.c
+++ b/audio/ossaudio.c
@@ -508,7 +508,7 @@ static void oss_fini_out (HWVoiceOut *hw)
}
}
else {
- qemu_free (oss->pcm_buf);
+ g_free (oss->pcm_buf);
}
oss->pcm_buf = NULL;
}
@@ -741,7 +741,7 @@ static void oss_fini_in (HWVoiceIn *hw)
oss_anal_close (&oss->fd);
if (oss->pcm_buf) {
- qemu_free (oss->pcm_buf);
+ g_free (oss->pcm_buf);
oss->pcm_buf = NULL;
}
}
diff --git a/audio/paaudio.c b/audio/paaudio.c
index fb4510e426..d1f3912cee 100644
--- a/audio/paaudio.c
+++ b/audio/paaudio.c
@@ -339,7 +339,7 @@ static int qpa_init_out (HWVoiceOut *hw, struct audsettings *as)
return 0;
fail3:
- qemu_free (pa->pcm_buf);
+ g_free (pa->pcm_buf);
pa->pcm_buf = NULL;
fail2:
pa_simple_free (pa->s);
@@ -394,7 +394,7 @@ static int qpa_init_in (HWVoiceIn *hw, struct audsettings *as)
return 0;
fail3:
- qemu_free (pa->pcm_buf);
+ g_free (pa->pcm_buf);
pa->pcm_buf = NULL;
fail2:
pa_simple_free (pa->s);
@@ -419,7 +419,7 @@ static void qpa_fini_out (HWVoiceOut *hw)
}
audio_pt_fini (&pa->pt, AUDIO_FUNC);
- qemu_free (pa->pcm_buf);
+ g_free (pa->pcm_buf);
pa->pcm_buf = NULL;
}
@@ -439,7 +439,7 @@ static void qpa_fini_in (HWVoiceIn *hw)
}
audio_pt_fini (&pa->pt, AUDIO_FUNC);
- qemu_free (pa->pcm_buf);
+ g_free (pa->pcm_buf);
pa->pcm_buf = NULL;
}
diff --git a/audio/wavaudio.c b/audio/wavaudio.c
index 294f35704f..aed18176ee 100644
--- a/audio/wavaudio.c
+++ b/audio/wavaudio.c
@@ -156,7 +156,7 @@ static int wav_init_out (HWVoiceOut *hw, struct audsettings *as)
if (!wav->f) {
dolog ("Failed to open wave file `%s'\nReason: %s\n",
conf.wav_path, strerror (errno));
- qemu_free (wav->pcm_buf);
+ g_free (wav->pcm_buf);
wav->pcm_buf = NULL;
return -1;
}
@@ -189,7 +189,7 @@ static void wav_fini_out (HWVoiceOut *hw)
qemu_fclose (wav->f);
wav->f = NULL;
- qemu_free (wav->pcm_buf);
+ g_free (wav->pcm_buf);
wav->pcm_buf = NULL;
}
diff --git a/audio/wavcapture.c b/audio/wavcapture.c
index 1f49cd1fec..c64f0ef075 100644
--- a/audio/wavcapture.c
+++ b/audio/wavcapture.c
@@ -48,7 +48,7 @@ static void wav_destroy (void *opaque)
qemu_fclose (wav->f);
}
- qemu_free (wav->path);
+ g_free (wav->path);
}
static void wav_capture (void *opaque, void *buf, int size)
@@ -120,7 +120,7 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
ops.capture = wav_capture;
ops.destroy = wav_destroy;
- wav = qemu_mallocz (sizeof (*wav));
+ wav = g_malloc0 (sizeof (*wav));
shift = bits16 + stereo;
hdr[34] = bits16 ? 0x10 : 0x08;
@@ -134,11 +134,11 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
if (!wav->f) {
monitor_printf(mon, "Failed to open wave file `%s'\nReason: %s\n",
path, strerror (errno));
- qemu_free (wav);
+ g_free (wav);
return -1;
}
- wav->path = qemu_strdup (path);
+ wav->path = g_strdup (path);
wav->bits = bits;
wav->nchannels = nchannels;
wav->freq = freq;
@@ -148,9 +148,9 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
cap = AUD_add_capture (&as, &ops, wav);
if (!cap) {
monitor_printf(mon, "Failed to add audio capture\n");
- qemu_free (wav->path);
+ g_free (wav->path);
qemu_fclose (wav->f);
- qemu_free (wav);
+ g_free (wav);
return -1;
}
diff --git a/audio/winwaveaudio.c b/audio/winwaveaudio.c
index e5ad3c6604..87e7493270 100644
--- a/audio/winwaveaudio.c
+++ b/audio/winwaveaudio.c
@@ -222,9 +222,9 @@ static int winwave_init_out (HWVoiceOut *hw, struct audsettings *as)
return 0;
err4:
- qemu_free (wave->pcm_buf);
+ g_free (wave->pcm_buf);
err3:
- qemu_free (wave->hdrs);
+ g_free (wave->hdrs);
err2:
winwave_anal_close_out (wave);
err1:
@@ -310,10 +310,10 @@ static void winwave_fini_out (HWVoiceOut *hw)
wave->event = NULL;
}
- qemu_free (wave->pcm_buf);
+ g_free (wave->pcm_buf);
wave->pcm_buf = NULL;
- qemu_free (wave->hdrs);
+ g_free (wave->hdrs);
wave->hdrs = NULL;
}
@@ -511,9 +511,9 @@ static int winwave_init_in (HWVoiceIn *hw, struct audsettings *as)
return 0;
err4:
- qemu_free (wave->pcm_buf);
+ g_free (wave->pcm_buf);
err3:
- qemu_free (wave->hdrs);
+ g_free (wave->hdrs);
err2:
winwave_anal_close_in (wave);
err1:
@@ -550,10 +550,10 @@ static void winwave_fini_in (HWVoiceIn *hw)
wave->event = NULL;
}
- qemu_free (wave->pcm_buf);
+ g_free (wave->pcm_buf);
wave->pcm_buf = NULL;
- qemu_free (wave->hdrs);
+ g_free (wave->hdrs);
wave->hdrs = NULL;
}