From patchwork Thu Jul 11 03:13:37 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wayne Xia X-Patchwork-Id: 258285 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 47FAB2C02CD for ; Thu, 11 Jul 2013 13:16:41 +1000 (EST) Received: from localhost ([::1]:37616 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux7N0-0002jm-Ta for incoming@patchwork.ozlabs.org; Wed, 10 Jul 2013 23:16:38 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39744) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux7MY-0002g5-0E for qemu-devel@nongnu.org; Wed, 10 Jul 2013 23:16:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ux7MX-0000wA-1s for qemu-devel@nongnu.org; Wed, 10 Jul 2013 23:16:09 -0400 Received: from e23smtp08.au.ibm.com ([202.81.31.141]:50777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ux7MW-0000ve-F1 for qemu-devel@nongnu.org; Wed, 10 Jul 2013 23:16:08 -0400 Received: from /spool/local by e23smtp08.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 11 Jul 2013 13:13:13 +1000 Received: from d23dlp01.au.ibm.com (202.81.31.203) by e23smtp08.au.ibm.com (202.81.31.205) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 11 Jul 2013 13:13:10 +1000 Received: from d23relay05.au.ibm.com (d23relay05.au.ibm.com [9.190.235.152]) by d23dlp01.au.ibm.com (Postfix) with ESMTP id 0CF632CE804D for ; Thu, 11 Jul 2013 13:16:04 +1000 (EST) Received: from d23av01.au.ibm.com (d23av01.au.ibm.com [9.190.234.96]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6B30kmN6553884 for ; Thu, 11 Jul 2013 13:00:46 +1000 Received: from d23av01.au.ibm.com (loopback [127.0.0.1]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6B3G2ju016055 for ; Thu, 11 Jul 2013 13:16:02 +1000 Received: from RH63Wenchao.localdomain ([9.125.25.246]) by d23av01.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id r6B3DtfM011597; Thu, 11 Jul 2013 13:16:00 +1000 From: Wenchao Xia To: qemu-devel@nongnu.org Date: Thu, 11 Jul 2013 11:13:37 +0800 Message-Id: <1373512429-17865-2-git-send-email-xiawenc@linux.vnet.ibm.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1373512429-17865-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1373512429-17865-1-git-send-email-xiawenc@linux.vnet.ibm.com> X-Content-Scanned: Fidelis XPS MAILER x-cbid: 13071103-5140-0000-0000-00000380A36E X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 202.81.31.141 Cc: pbonzini@redhat.com, Wenchao Xia , armbru@redhat.com, lcapitulino@redhat.com Subject: [Qemu-devel] [PATCH V6 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 --- monitor.c | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-) diff --git a/monitor.c b/monitor.c index 2ba7876..7398d00 100644 --- a/monitor.c +++ b/monitor.c @@ -3996,7 +3996,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]; @@ -4014,7 +4014,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; @@ -4128,6 +4128,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 @@ -4153,7 +4154,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 */ @@ -4194,7 +4195,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, '-'); @@ -4202,12 +4203,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;