From patchwork Sat Jul 20 01:44:03 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 260389 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 1F68C2C009E for ; Sat, 20 Jul 2013 11:49:58 +1000 (EST) Received: from localhost ([::1]:46210 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0MJ1-000814-Ut for incoming@patchwork.ozlabs.org; Fri, 19 Jul 2013 21:49:55 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55700) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0MFZ-0002x2-0M for qemu-devel@nongnu.org; Fri, 19 Jul 2013 21:46:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0MFX-0002fJ-I0 for qemu-devel@nongnu.org; Fri, 19 Jul 2013 21:46:20 -0400 Received: from e28smtp06.in.ibm.com ([122.248.162.6]:39678) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0MFW-0002ek-V8 for qemu-devel@nongnu.org; Fri, 19 Jul 2013 21:46:19 -0400 Received: from /spool/local by e28smtp06.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 20 Jul 2013 07:07:50 +0530 Received: from d28dlp02.in.ibm.com (9.184.220.127) by e28smtp06.in.ibm.com (192.168.1.136) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Sat, 20 Jul 2013 07:07:48 +0530 Received: from d28relay02.in.ibm.com (d28relay02.in.ibm.com [9.184.220.59]) by d28dlp02.in.ibm.com (Postfix) with ESMTP id B6ECD394004E for ; Sat, 20 Jul 2013 07:16:04 +0530 (IST) Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay02.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6K1kxi024969384 for ; Sat, 20 Jul 2013 07:16:59 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6K1k7NS021555 for ; Sat, 20 Jul 2013 01:46:07 GMT Received: from RH63Wenchao ([9.77.181.206]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6K1iXRn018239; Sat, 20 Jul 2013 01:46:05 GMT From: Wenchao Xia To: qemu-devel@nongnu.org Date: Sat, 20 Jul 2013 09:44:03 +0800 Message-Id: <1374284656-12025-2-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1374284656-12025-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1374284656-12025-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-TM-AS-MML: No X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13072001-9574-0000-0000-000008CCA524 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 122.248.162.6 Cc: pbonzini@redhat.com, Wenchao Xia , armbru@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH V7 01/13] 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 convertion 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 6db2ba4..b88c02b 100644 --- a/monitor.c +++ b/monitor.c @@ -4004,7 +4004,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]; @@ -4022,7 +4022,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; @@ -4136,6 +4136,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 @@ -4161,7 +4162,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 */ @@ -4202,7 +4203,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, '-'); @@ -4210,12 +4211,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;