From patchwork Thu Aug 13 13:50:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 31322 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by bilbo.ozlabs.org (Postfix) with ESMTPS id 65002B708B for ; Fri, 14 Aug 2009 00:33:19 +1000 (EST) Received: from localhost ([127.0.0.1]:48145 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbbMg-0001PW-Tt for incoming@patchwork.ozlabs.org; Thu, 13 Aug 2009 10:33:14 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mbaif-00017N-A4 for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MbaiZ-00010D-Vq for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:52 -0400 Received: from [199.232.76.173] (port=33514 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MbaiZ-000103-LX for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:47 -0400 Received: from mx2.redhat.com ([66.187.237.31]:45135) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MbaiY-0003ND-Tr for qemu-devel@nongnu.org; Thu, 13 Aug 2009 09:51:47 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n7DDpkqq023409; Thu, 13 Aug 2009 09:51:46 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx2.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n7DDpjtS027504; Thu, 13 Aug 2009 09:51:45 -0400 Received: from localhost (vpn-10-83.bos.redhat.com [10.16.10.83]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n7DDph09012243; Thu, 13 Aug 2009 09:51:44 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 13 Aug 2009 10:50:20 -0300 Message-Id: <1250171428-29308-22-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1250171428-29308-1-git-send-email-lcapitulino@redhat.com> References: <1250171428-29308-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.58 on 172.16.27.26 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 3) Cc: aliguori@us.ibm.com, avi@redhat.com Subject: [Qemu-devel] [PATCH 21/29] monitor: Drop str_allocated[] X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org It's not used anymore, as QDict is now used to handle string memory allocation/deallocation. Signed-off-by: Luiz Capitulino --- monitor.c | 13 ++----------- 1 files changed, 2 insertions(+), 11 deletions(-) diff --git a/monitor.c b/monitor.c index c56124b..f4b3872 100644 --- a/monitor.c +++ b/monitor.c @@ -2641,7 +2641,6 @@ static int default_fmt_size = 4; static const mon_cmd_t *monitor_parse_command(Monitor *mon, const char *cmdline, - void *str_allocated[], QDict *qdict) { const char *p, *typestr; @@ -2718,7 +2717,6 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, } str = qemu_malloc(strlen(buf) + 1); pstrcpy(str, sizeof(buf), buf); - str_allocated[nb_args] = str; add_str: if (nb_args >= MAX_ARGS) { error_args: @@ -2728,6 +2726,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, args[nb_args++] = str; if (str) qdict_add_qstring(qdict, key, qstring_from_str(str)); + qemu_free(str); } break; case '/': @@ -2925,17 +2924,12 @@ fail: static void monitor_handle_command(Monitor *mon, const char *cmdline) { - int i; QDict *qdict; const mon_cmd_t *cmd; - void *str_allocated[MAX_ARGS]; qdict = qdict_new(); - for (i = 0; i < MAX_ARGS; i++) - str_allocated[i] = NULL; - - cmd = monitor_parse_command(mon, cmdline, str_allocated, qdict); + cmd = monitor_parse_command(mon, cmdline, qdict); if (cmd) { void (*handler)(Monitor *mon, const QDict *qdict); handler = cmd->handler; @@ -2943,9 +2937,6 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) } qobject_decref(QOBJECT(qdict)); - - for (i = 0; i < MAX_ARGS; i++) - qemu_free(str_allocated[i]); } static void cmd_completion(const char *name, const char *list)