Commit 090f1fa3237cbbc2338d29fe7ddb7d35396cddbb
1 parent
3ec88e80
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
Showing
2 changed files
with
8 additions
and
20 deletions
audio/audio.c
@@ -197,8 +197,8 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size) | @@ -197,8 +197,8 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size) | ||
197 | static char *audio_alloc_prefix (const char *s) | 197 | static char *audio_alloc_prefix (const char *s) |
198 | { | 198 | { |
199 | const char qemu_prefix[] = "QEMU_"; | 199 | const char qemu_prefix[] = "QEMU_"; |
200 | - size_t len; | ||
201 | - char *r; | 200 | + size_t len, i; |
201 | + char *r, *u; | ||
202 | 202 | ||
203 | if (!s) { | 203 | if (!s) { |
204 | return NULL; | 204 | return NULL; |
@@ -207,17 +207,15 @@ static char *audio_alloc_prefix (const char *s) | @@ -207,17 +207,15 @@ static char *audio_alloc_prefix (const char *s) | ||
207 | len = strlen (s); | 207 | len = strlen (s); |
208 | r = qemu_malloc (len + sizeof (qemu_prefix)); | 208 | r = qemu_malloc (len + sizeof (qemu_prefix)); |
209 | 209 | ||
210 | - if (r) { | ||
211 | - size_t i; | ||
212 | - char *u = r + sizeof (qemu_prefix) - 1; | 210 | + u = r + sizeof (qemu_prefix) - 1; |
213 | 211 | ||
214 | - pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix); | ||
215 | - pstrcat (r, len + sizeof (qemu_prefix), s); | 212 | + pstrcpy (r, len + sizeof (qemu_prefix), qemu_prefix); |
213 | + pstrcat (r, len + sizeof (qemu_prefix), s); | ||
216 | 214 | ||
217 | - for (i = 0; i < len; ++i) { | ||
218 | - u[i] = qemu_toupper(u[i]); | ||
219 | - } | 215 | + for (i = 0; i < len; ++i) { |
216 | + u[i] = qemu_toupper(u[i]); | ||
220 | } | 217 | } |
218 | + | ||
221 | return r; | 219 | return r; |
222 | } | 220 | } |
223 | 221 | ||
@@ -460,11 +458,6 @@ static void audio_process_options (const char *prefix, | @@ -460,11 +458,6 @@ static void audio_process_options (const char *prefix, | ||
460 | * sizeof) */ | 458 | * sizeof) */ |
461 | optlen = len + preflen + sizeof (qemu_prefix) + 1; | 459 | optlen = len + preflen + sizeof (qemu_prefix) + 1; |
462 | optname = qemu_malloc (optlen); | 460 | optname = qemu_malloc (optlen); |
463 | - if (!optname) { | ||
464 | - dolog ("Could not allocate memory for option name `%s'\n", | ||
465 | - opt->name); | ||
466 | - continue; | ||
467 | - } | ||
468 | 461 | ||
469 | pstrcpy (optname, optlen, qemu_prefix); | 462 | pstrcpy (optname, optlen, qemu_prefix); |
470 | 463 |
audio/wavcapture.c
@@ -120,11 +120,6 @@ int wav_start_capture (CaptureState *s, const char *path, int freq, | @@ -120,11 +120,6 @@ int wav_start_capture (CaptureState *s, const char *path, int freq, | ||
120 | ops.destroy = wav_destroy; | 120 | ops.destroy = wav_destroy; |
121 | 121 | ||
122 | wav = qemu_mallocz (sizeof (*wav)); | 122 | wav = qemu_mallocz (sizeof (*wav)); |
123 | - if (!wav) { | ||
124 | - term_printf ("Could not allocate memory for wav capture (%zu bytes)", | ||
125 | - sizeof (*wav)); | ||
126 | - return -1; | ||
127 | - } | ||
128 | 123 | ||
129 | shift = bits16 + stereo; | 124 | shift = bits16 + stereo; |
130 | hdr[34] = bits16 ? 0x10 : 0x08; | 125 | hdr[34] = bits16 ? 0x10 : 0x08; |