qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: kwolf@redhat.com, stefanha@redhat.com, mreitz@redhat.com
Subject: [Qemu-devel] [PATCH v2 3/4] qemu-io-cmds: g_renew() can't fail, bury dead error handling
Date: Mon, 18 Aug 2014 18:10:42 +0200	[thread overview]
Message-ID: <1408378243-19713-4-git-send-email-armbru@redhat.com> (raw)
In-Reply-To: <1408378243-19713-1-git-send-email-armbru@redhat.com>

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 qemu-io-cmds.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/qemu-io-cmds.c b/qemu-io-cmds.c
index afd8867..b224ede 100644
--- a/qemu-io-cmds.c
+++ b/qemu-io-cmds.c
@@ -115,22 +115,13 @@ static char **breakline(char *input, int *count)
     int c = 0;
     char *p;
     char **rval = g_new0(char *, 1);
-    char **tmp;
 
     while (rval && (p = qemu_strsep(&input, " ")) != NULL) {
         if (!*p) {
             continue;
         }
         c++;
-        tmp = g_renew(char *, rval, (c + 1));
-        if (!tmp) {
-            g_free(rval);
-            rval = NULL;
-            c = 0;
-            break;
-        } else {
-            rval = tmp;
-        }
+        rval = g_renew(char *, rval, (c + 1));
         rval[c - 1] = p;
         rval[c] = NULL;
     }
-- 
1.9.3

  parent reply	other threads:[~2014-08-18 16:11 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-18 16:10 [Qemu-devel] [PATCH v2 0/4] block: Use g_new() & friends more Markus Armbruster
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 1/4] block: Use g_new() & friends where that makes obvious sense Markus Armbruster
2014-08-18 16:35   ` Max Reitz
2014-08-18 19:43   ` Jeff Cody
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 2/4] block: Use g_new() & friends to avoid multiplying sizes Markus Armbruster
2014-08-18 16:48   ` Max Reitz
2014-08-18 19:57   ` Jeff Cody
2014-08-18 16:10 ` Markus Armbruster [this message]
2014-08-18 16:50   ` [Qemu-devel] [PATCH v2 3/4] qemu-io-cmds: g_renew() can't fail, bury dead error handling Max Reitz
2014-08-18 19:59   ` Jeff Cody
2014-08-18 16:10 ` [Qemu-devel] [PATCH v2 4/4] block: Drop some superfluous casts from void * Markus Armbruster
2014-08-18 16:58   ` Max Reitz
2014-08-19  7:10     ` Markus Armbruster
2014-08-18 20:06   ` Jeff Cody
2014-08-19  7:10     ` Markus Armbruster
2014-08-19  8:33       ` Markus Armbruster

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=1408378243-19713-4-git-send-email-armbru@redhat.com \
    --to=armbru@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /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).