From patchwork Tue Aug 27 12:38:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 270108 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 29D022C00DC for ; Tue, 27 Aug 2013 22:44:39 +1000 (EST) Received: from localhost ([::1]:56193 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEIdQ-0004Em-Jb for incoming@patchwork.ozlabs.org; Tue, 27 Aug 2013 08:44:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38515) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEIZ5-0006Jo-Rr for qemu-devel@nongnu.org; Tue, 27 Aug 2013 08:40:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEIYv-0008Ru-Hm for qemu-devel@nongnu.org; Tue, 27 Aug 2013 08:40:07 -0400 Received: from e23smtp03.au.ibm.com ([202.81.31.145]:48734) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEIYu-0008RU-Ui for qemu-devel@nongnu.org; Tue, 27 Aug 2013 08:39:57 -0400 Received: from /spool/local by e23smtp03.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 27 Aug 2013 22:28:40 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp03.au.ibm.com (202.81.31.209) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 27 Aug 2013 22:28:37 +1000 Received: from d23relay04.au.ibm.com (d23relay04.au.ibm.com [9.190.234.120]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 3167D2CE804C for ; Tue, 27 Aug 2013 22:39:49 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay04.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7RCNidf62259324 for ; Tue, 27 Aug 2013 22:23:44 +1000 Received: from d23av01.au.ibm.com (localhost [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7RCdmed030916 for ; Tue, 27 Aug 2013 22:39:48 +1000 Received: from RH63Wenchao.localdomain ([9.77.176.7]) by d23av01.au.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id r7RCc3mv029119; Tue, 27 Aug 2013 22:39:46 +1000 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Tue, 27 Aug 2013 20:38:13 +0800 Message-Id: <1377607107-11612-2-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1377607107-11612-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1377607107-11612-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13082712-6102-0000-0000-00000414A05B X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.145 Cc: Wenchao Xia , armbru@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH V10 01/15] monitor: avoid use of global *cur_mon in cmd_completion() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org A new local variable *mon is added in monitor_find_completion() to make compile pass, which will be removed later in conversion patch for monitor_find_completion(). Signed-off-by: Wenchao Xia Reviewed-by: Eric Blake --- monitor.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/monitor.c b/monitor.c index ee9744c..31b527d 100644 --- a/monitor.c +++ b/monitor.c @@ -4008,7 +4008,7 @@ out: QDECREF(qdict); } -static void cmd_completion(const char *name, const char *list) +static void cmd_completion(Monitor *mon, const char *name, const char *list) { const char *p, *pstart; char cmd[128]; @@ -4026,7 +4026,7 @@ static void cmd_completion(const char *name, const char *list) memcpy(cmd, pstart, len); cmd[len] = '\0'; if (name[0] == '\0' || !strncmp(name, cmd, strlen(name))) { - readline_add_completion(cur_mon->rs, cmd); + readline_add_completion(mon->rs, cmd); } if (*p == '\0') break; @@ -4140,6 +4140,7 @@ static void monitor_find_completion(const char *cmdline) int nb_args, i, len; const char *ptype, *str; const mon_cmd_t *cmd; + Monitor *mon = cur_mon; parse_cmdline(cmdline, &nb_args, args); #ifdef DEBUG_COMPLETION @@ -4165,7 +4166,7 @@ static void monitor_find_completion(const char *cmdline) cmdname = args[0]; readline_set_completion_index(cur_mon->rs, strlen(cmdname)); for(cmd = mon_cmds; cmd->name != NULL; cmd++) { - cmd_completion(cmdname, cmd->name); + cmd_completion(mon, cmdname, cmd->name); } } else { /* find the command */ @@ -4206,7 +4207,7 @@ static void monitor_find_completion(const char *cmdline) if (!strcmp(cmd->name, "info")) { readline_set_completion_index(cur_mon->rs, strlen(str)); for(cmd = info_cmds; cmd->name != NULL; cmd++) { - cmd_completion(str, cmd->name); + cmd_completion(mon, str, cmd->name); } } else if (!strcmp(cmd->name, "sendkey")) { char *sep = strrchr(str, '-'); @@ -4214,12 +4215,12 @@ static void monitor_find_completion(const char *cmdline) str = sep + 1; readline_set_completion_index(cur_mon->rs, strlen(str)); for (i = 0; i < Q_KEY_CODE_MAX; i++) { - cmd_completion(str, QKeyCode_lookup[i]); + cmd_completion(mon, str, QKeyCode_lookup[i]); } } else if (!strcmp(cmd->name, "help|?")) { readline_set_completion_index(cur_mon->rs, strlen(str)); for (cmd = mon_cmds; cmd->name != NULL; cmd++) { - cmd_completion(str, cmd->name); + cmd_completion(mon, str, cmd->name); } } break;