static char *audio_alloc_prefix (const char *s)
{
const char qemu_prefix[] = "QEMU_";
- size_t len;
- char *r;
+ size_t len, i;
+ char *r, *u;
if (!s) {
return NULL;
len = strlen (s);
r = qemu_malloc (len + sizeof (qemu_prefix));
- if (r) {
- size_t i;
- char *u = r + sizeof (qemu_prefix) - 1;
+ u = r + sizeof (qemu_prefix) - 1;
- pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix);
- pstrcat (r, len + sizeof (qemu_prefix), s);
+ pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix);
+ pstrcat (r, len + sizeof (qemu_prefix), s);
- for (i = 0; i < len; ++i) {
- u[i] = qemu_toupper(u[i]);
- }
+ for (i = 0; i < len; ++i) {
+ u[i] = qemu_toupper(u[i]);
}
+
return r;
}
* sizeof) */
optlen = len + preflen + sizeof (qemu_prefix) + 1;
optname = qemu_malloc (optlen);
- if (!optname) {
- dolog ("Could not allocate memory for option name `%s'\n",
- opt->name);
- continue;
- }
pstrcpy (optname, optlen, qemu_prefix);
ops.destroy = wav_destroy;
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;
hdr[34] = bits16 ? 0x10 : 0x08;