mirror of https://github.com/xemu-project/xemu.git
audio: remove error handling from qemu_malloc() callers (Avi Kivity)
Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com> git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6528 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
parent
3ec88e8036
commit
090f1fa323
|
@ -197,8 +197,8 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size)
|
||||||
static char *audio_alloc_prefix (const char *s)
|
static char *audio_alloc_prefix (const char *s)
|
||||||
{
|
{
|
||||||
const char qemu_prefix[] = "QEMU_";
|
const char qemu_prefix[] = "QEMU_";
|
||||||
size_t len;
|
size_t len, i;
|
||||||
char *r;
|
char *r, *u;
|
||||||
|
|
||||||
if (!s) {
|
if (!s) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -207,17 +207,15 @@ static char *audio_alloc_prefix (const char *s)
|
||||||
len = strlen (s);
|
len = strlen (s);
|
||||||
r = qemu_malloc (len + sizeof (qemu_prefix));
|
r = qemu_malloc (len + sizeof (qemu_prefix));
|
||||||
|
|
||||||
if (r) {
|
u = r + sizeof (qemu_prefix) - 1;
|
||||||
size_t i;
|
|
||||||
char *u = r + sizeof (qemu_prefix) - 1;
|
|
||||||
|
|
||||||
pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix);
|
pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix);
|
||||||
pstrcat (r, len + sizeof (qemu_prefix), s);
|
pstrcat (r, len + sizeof (qemu_prefix), s);
|
||||||
|
|
||||||
for (i = 0; i < len; ++i) {
|
for (i = 0; i < len; ++i) {
|
||||||
u[i] = qemu_toupper(u[i]);
|
u[i] = qemu_toupper(u[i]);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,11 +458,6 @@ static void audio_process_options (const char *prefix,
|
||||||
* sizeof) */
|
* sizeof) */
|
||||||
optlen = len + preflen + sizeof (qemu_prefix) + 1;
|
optlen = len + preflen + sizeof (qemu_prefix) + 1;
|
||||||
optname = qemu_malloc (optlen);
|
optname = qemu_malloc (optlen);
|
||||||
if (!optname) {
|
|
||||||
dolog ("Could not allocate memory for option name `%s'\n",
|
|
||||||
opt->name);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
pstrcpy (optname, optlen, qemu_prefix);
|
pstrcpy (optname, optlen, qemu_prefix);
|
||||||
|
|
||||||
|
|
|
@ -120,11 +120,6 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
|
||||||
ops.destroy = wav_destroy;
|
ops.destroy = wav_destroy;
|
||||||
|
|
||||||
wav = qemu_mallocz (sizeof (*wav));
|
wav = qemu_mallocz (sizeof (*wav));
|
||||||
if (!wav) {
|
|
||||||
term_printf ("Could not allocate memory for wav capture (%zu bytes)",
|
|
||||||
sizeof (*wav));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
shift = bits16 + stereo;
|
shift = bits16 + stereo;
|
||||||
hdr[34] = bits16 ? 0x10 : 0x08;
|
hdr[34] = bits16 ? 0x10 : 0x08;
|
||||||
|
|
Loading…
Reference in New Issue