qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <anthony@codemonkey.ws>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [6528] audio: remove error handling from qemu_malloc() callers (Avi Kivity)
Date: Thu, 05 Feb 2009 22:05:58 +0000	[thread overview]
Message-ID: <E1LVCMA-0007h5-PP@cvs.savannah.gnu.org> (raw)

Revision: 6528
          http://svn.sv.gnu.org/viewvc/?view=rev&root=qemu&revision=6528
Author:   aliguori
Date:     2009-02-05 22:05:58 +0000 (Thu, 05 Feb 2009)

Log Message:
-----------
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>

Modified Paths:
--------------
    trunk/audio/audio.c
    trunk/audio/wavcapture.c

Modified: trunk/audio/audio.c
===================================================================
--- trunk/audio/audio.c	2009-02-05 22:05:53 UTC (rev 6527)
+++ trunk/audio/audio.c	2009-02-05 22:05:58 UTC (rev 6528)
@@ -197,8 +197,8 @@
 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 @@
     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 @@
          * 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);
 

Modified: trunk/audio/wavcapture.c
===================================================================
--- trunk/audio/wavcapture.c	2009-02-05 22:05:53 UTC (rev 6527)
+++ trunk/audio/wavcapture.c	2009-02-05 22:05:58 UTC (rev 6528)
@@ -120,11 +120,6 @@
     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;

                 reply	other threads:[~2009-02-05 22:06 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=E1LVCMA-0007h5-PP@cvs.savannah.gnu.org \
    --to=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).