From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MgLxp-0003wk-4Y for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:07:13 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MgLxk-0003qf-BB for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:07:12 -0400 Received: from [199.232.76.173] (port=45831 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MgLxj-0003qF-LF for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:07:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64377) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MgLxi-0000pr-QM for qemu-devel@nongnu.org; Wed, 26 Aug 2009 13:07:07 -0400 From: Luiz Capitulino Date: Wed, 26 Aug 2009 14:05:44 -0300 Message-Id: <1251306352-31316-22-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1251306352-31316-1-git-send-email-lcapitulino@redhat.com> References: <1251306352-31316-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 21/29] monitor: Drop str_allocated[] List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com, avi@redhat.com 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 e6c48cf..2334f7a 100644 --- a/monitor.c +++ b/monitor.c @@ -2569,7 +2569,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; @@ -2646,7 +2645,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: @@ -2656,6 +2654,7 @@ static const mon_cmd_t *monitor_parse_command(Monitor *mon, args[nb_args++] = str; if (str) qdict_put(qdict, key, qstring_from_str(str)); + qemu_free(str); } break; case '/': @@ -2853,17 +2852,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; @@ -2871,9 +2865,6 @@ static void monitor_handle_command(Monitor *mon, const char *cmdline) } QDECREF(qdict); - - for (i = 0; i < MAX_ARGS; i++) - qemu_free(str_allocated[i]); } static void cmd_completion(const char *name, const char *list) -- 1.6.4.1.184.g2e117