From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 83033 invoked by alias); 4 May 2015 19:18:19 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 82930 invoked by uid 89); 4 May 2015 19:18:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Mon, 04 May 2015 19:18:16 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t44JIEoO019019 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 4 May 2015 15:18:14 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t44JIEa2026723 for ; Mon, 4 May 2015 15:18:14 -0400 Subject: [PATCH v2 03/18] Implement completion limiting for complete_on_cmdlist. From: Keith Seitz To: gdb-patches@sourceware.org Date: Mon, 04 May 2015 19:18:00 -0000 Message-ID: <20150504191814.20434.83624.stgit@valrhona.uglyboxes.com> In-Reply-To: <20150504191734.20434.68053.stgit@valrhona.uglyboxes.com> References: <20150504191734.20434.68053.stgit@valrhona.uglyboxes.com> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg00048.txt.bz2 This is the first of a series of smaller patches to switch over all completion functions to using maybe_add_completion to add completions to the completion list to be presented to the user. Note that in order to verify that this patch works as intended, one must override the backup completion counting in complete_line. [This backup code will be permanently removed in a later patch.] During testing, I have verified all patches with this planned code removal to verify that it works. First up is complete_on_cmdlist. Completion limiting is already tested in gdb.base/completion.exp, so there are no new tests. gdb/ChangeLog * cli/cli-decode.c (complete_on_cmdlist): Use add_completion to determine whether to continue looking for completions. --- gdb/cli/cli-decode.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c index 286fc61..011c427 100644 --- a/gdb/cli/cli-decode.c +++ b/gdb/cli/cli-decode.c @@ -1815,7 +1815,9 @@ complete_on_cmdlist (struct completer_data *cdata, match[text - word] = '\0'; strcat (match, ptr->name); } - VEC_safe_push (char_ptr, matchlist, match); + if (add_completion (cdata, &matchlist, match) + == ADD_COMPLETION_MAX_REACHED) + return matchlist; } /* If we saw no matching deprecated commands in the first pass, just bail out. */