From: Avi Kivity <avi@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/6] audio: remove error handling from qemu_malloc() callers
Date: Thu, 5 Feb 2009 13:08:43 +0200 [thread overview]
Message-ID: <1233832126-9046-4-git-send-email-avi@redhat.com> (raw)
In-Reply-To: <1233832126-9046-1-git-send-email-avi@redhat.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
---
audio/audio.c | 23 ++++++++---------------
audio/wavcapture.c | 5 -----
2 files changed, 8 insertions(+), 20 deletions(-)
diff --git a/audio/audio.c b/audio/audio.c
index e2635c0..b0a5f3b 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -197,8 +197,8 @@ void *audio_calloc (const char *funcname, int nmemb, size_t size)
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;
@@ -207,17 +207,15 @@ static char *audio_alloc_prefix (const char *s)
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;
}
@@ -460,11 +458,6 @@ static void audio_process_options (const char *prefix,
* 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);
diff --git a/audio/wavcapture.c b/audio/wavcapture.c
index 9919171..6d1c441 100644
--- a/audio/wavcapture.c
+++ b/audio/wavcapture.c
@@ -120,11 +120,6 @@ int wav_start_capture (CaptureState *s, const char *path, int freq,
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;
--
1.6.1.1
next prev parent reply other threads:[~2009-02-05 11:09 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 11:08 [Qemu-devel] [PATCH 0/6] Unify memory allocation failure handling Avi Kivity
2009-02-05 11:08 ` [Qemu-devel] [PATCH 1/6] Terminate emulation on memory allocation failure Avi Kivity
2009-02-05 12:01 ` Daniel P. Berrange
2009-02-05 12:22 ` Avi Kivity
2009-02-05 17:43 ` Ian Jackson
2009-02-05 11:08 ` [Qemu-devel] [PATCH 2/6] block: remove error handling from qemu_malloc() callers Avi Kivity
2009-02-05 11:08 ` Avi Kivity [this message]
2009-02-05 11:08 ` [Qemu-devel] [PATCH 4/6] hw: " Avi Kivity
2009-02-05 11:08 ` [Qemu-devel] [PATCH 5/6] targets: " Avi Kivity
2009-02-05 11:08 ` [Qemu-devel] [PATCH 6/6] toplevel: " Avi Kivity
2009-02-05 17:43 ` [Qemu-devel] [PATCH 0/6] Unify memory allocation failure handling Ian Jackson
2009-02-05 22:07 ` [Qemu-devel] " Anthony Liguori
2009-02-06 8:47 ` Avi Kivity
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1233832126-9046-4-git-send-email-avi@redhat.com \
--to=avi@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).