From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38317) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Ycd-0001g9-2I for qemu-devel@nongnu.org; Thu, 25 Jul 2013 23:23:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V2Ycc-0005qq-6D for qemu-devel@nongnu.org; Thu, 25 Jul 2013 23:23:15 -0400 Received: from e28smtp03.in.ibm.com ([122.248.162.3]:41890) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V2Ycb-0005pm-7u for qemu-devel@nongnu.org; Thu, 25 Jul 2013 23:23:14 -0400 Received: from /spool/local by e28smtp03.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 26 Jul 2013 08:46:14 +0530 Received: from d28relay01.in.ibm.com (d28relay01.in.ibm.com [9.184.220.58]) by d28dlp01.in.ibm.com (Postfix) with ESMTP id D815DE004F for ; Fri, 26 Jul 2013 08:53:09 +0530 (IST) Received: from d28av03.in.ibm.com (d28av03.in.ibm.com [9.184.220.65]) by d28relay01.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r6Q3O17B24576190 for ; Fri, 26 Jul 2013 08:54:01 +0530 Received: from d28av03.in.ibm.com (loopback [127.0.0.1]) by d28av03.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id r6Q3N5AJ021070 for ; Fri, 26 Jul 2013 13:23:06 +1000 From: Wenchao Xia Date: Fri, 26 Jul 2013 11:20:34 +0800 Message-Id: <1374808842-11051-6-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1374808842-11051-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1374808842-11051-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V8 05/13] monitor: avoid use of global *cur_mon in readline_completion() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: pbonzini@redhat.com, Wenchao Xia , armbru@redhat.com, lcapitulino@redhat.com Now all completion functions do not use *cur_mon any more, instead they use rs->mon. In short, structure ReadLineState decide where the complete action would be taken now. Tested with the case that qemu have two telnet monitors, auto completion function works normal. Signed-off-by: Wenchao Xia Reviewed-by: Eric Blake --- readline.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-) diff --git a/readline.c b/readline.c index c91b324..abf27dd 100644 --- a/readline.c +++ b/readline.c @@ -276,7 +276,6 @@ void readline_set_completion_index(ReadLineState *rs, int index) static void readline_completion(ReadLineState *rs) { - Monitor *mon = cur_mon; int len, i, j, max_width, nb_cols, max_prefix; char *cmdline; @@ -300,7 +299,7 @@ static void readline_completion(ReadLineState *rs) if (len > 0 && rs->completions[0][len - 1] != '/') readline_insert_char(rs, ' '); } else { - monitor_printf(mon, "\n"); + monitor_printf(rs->mon, "\n"); max_width = 0; max_prefix = 0; for(i = 0; i < rs->nb_completions; i++) { -- 1.7.1