From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58532) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCmbR-0005lh-8m for qemu-devel@nongnu.org; Fri, 23 Aug 2013 04:20:26 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VCmbG-0007Qf-Qj for qemu-devel@nongnu.org; Fri, 23 Aug 2013 04:20:17 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:55840) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VCmbG-0007Lt-7Y for qemu-devel@nongnu.org; Fri, 23 Aug 2013 04:20:06 -0400 Received: from /spool/local by e28smtp09.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 23 Aug 2013 13:44:07 +0530 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id BBBE81258053 for ; Fri, 23 Aug 2013 13:49:47 +0530 (IST) Received: from d28av05.in.ibm.com (d28av05.in.ibm.com [9.184.220.67]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r7N8JvSj46465080 for ; Fri, 23 Aug 2013 13:49:57 +0530 Received: from d28av05.in.ibm.com (localhost [127.0.0.1]) by d28av05.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r7N8Jx0R007019 for ; Fri, 23 Aug 2013 13:49:59 +0530 From: Wenchao Xia Date: Fri, 23 Aug 2013 16:17:57 +0800 Message-Id: <1377245887-22745-6-git-send-email-xiawenc@linux.vnet.ibm.com> In-Reply-To: <1377245887-22745-1-git-send-email-xiawenc@linux.vnet.ibm.com> References: <1377245887-22745-1-git-send-email-xiawenc@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH V9 05/15] 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