From patchwork Thu Feb 23 17:24:01 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pedro Alves X-Patchwork-Id: 19359 Received: (qmail 50155 invoked by alias); 23 Feb 2017 17:24:31 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 50072 invoked by uid 89); 23 Feb 2017 17:24:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.9 required=5.0 tests=BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= 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 ESMTP; Thu, 23 Feb 2017 17:24:18 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0FF1C7FB7F for ; Thu, 23 Feb 2017 17:24:06 +0000 (UTC) Received: from cascais.lan (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1NHO4hG030815 for ; Thu, 23 Feb 2017 12:24:05 -0500 From: Pedro Alves To: gdb-patches@sourceware.org Subject: [PATCH v2 1/2] symtab.c: Small refactor Date: Thu, 23 Feb 2017 17:24:01 +0000 Message-Id: <1487870642-29926-2-git-send-email-palves@redhat.com> In-Reply-To: <1487870642-29926-1-git-send-email-palves@redhat.com> References: <86a89cc2u6.fsf@gmail.com> <1487870642-29926-1-git-send-email-palves@redhat.com> add_symtab_completions does the exact same as the code that it is replacing. gdb/ChangeLog: yyyy-mm-dd Pedro Alves * symtab.c (make_file_symbol_completion_list_1): Use add_symtab_completions. --- gdb/symtab.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/gdb/symtab.c b/gdb/symtab.c index b9f4f77..c0fd0fd 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -5391,10 +5391,7 @@ static VEC (char_ptr) * make_file_symbol_completion_list_1 (const char *text, const char *word, const char *srcfile) { - struct symbol *sym; struct symtab *s; - struct block *b; - struct block_iterator iter; /* The symbol we are completing on. Points in same buffer as text. */ const char *sym_text; /* Length of sym_text. */ @@ -5464,18 +5461,9 @@ make_file_symbol_completion_list_1 (const char *text, const char *word, /* Go through this symtab and check the externs and statics for symbols which match. */ - - b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), GLOBAL_BLOCK); - ALL_BLOCK_SYMBOLS (b, iter, sym) - { - COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); - } - - b = BLOCKVECTOR_BLOCK (SYMTAB_BLOCKVECTOR (s), STATIC_BLOCK); - ALL_BLOCK_SYMBOLS (b, iter, sym) - { - COMPLETION_LIST_ADD_SYMBOL (sym, sym_text, sym_text_len, text, word); - } + add_symtab_completions (SYMTAB_COMPUNIT (s), + sym_text, sym_text_len, + text, word, TYPE_CODE_UNDEF); return (return_val); }