From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26110 invoked by alias); 7 May 2013 19:46:58 -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 26098 invoked by uid 89); 7 May 2013 19:46:58 -0000 X-Spam-SWARE-Status: No, score=-6.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS,TW_BJ autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Tue, 07 May 2013 19:46:57 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r47JkuBu015386 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 7 May 2013 15:46:56 -0400 Received: from valrhona.uglyboxes.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r47JktHJ027469 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO) for ; Tue, 7 May 2013 15:46:56 -0400 Message-ID: <51895A2F.8000504@redhat.com> Date: Tue, 07 May 2013 19:46:00 -0000 From: Keith Seitz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: "gdb-patches@sourceware.org ml" Subject: [RFC] Cleanup for make_source_files_completion_list Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2013-05/txt/msg00259.txt.bz2 Hi, make_source_files_completion_list is only ever called with the first parameter twice, e.g., fn_list = make_source_files_completion_list (text, text); Is there any reason to not whack the second parameter as the following patch does? Keith ChangeLog 2013-05-07 Keith Seitz * symtab.h (make_source_files_completion_list): Remove unused second parameter. * completer.c (location_completer): Update call to make_source_files_completion_list. * symtab.c (maybe_add_partial_symtab_filename): Likewise. (make_source_files_completion_list): Remove unused second parameter. Pass text to add_filename_to_list instead of word. Set datum.word to text, too. diff --git a/gdb/symtab.h b/gdb/symtab.h index c735e16..8703f77 100644 --- a/gdb/symtab.h +++ b/gdb/symtab.h @@ -1241,8 +1241,7 @@ extern VEC (char_ptr) *make_file_symbol_completion_list (const char *, const char *, const char *); -extern VEC (char_ptr) *make_source_files_completion_list (const char *, - const char *); +extern VEC (char_ptr) *make_source_files_completion_list (const char *); /* symtab.c */ diff --git a/gdb/completer.c b/gdb/completer.c index e132651..b4845cb 100644 --- a/gdb/completer.c +++ b/gdb/completer.c @@ -270,7 +270,7 @@ location_completer (struct cmd_list_element *ignore, name, they cannot be asking for completion on files. */ if (strcspn (text, gdb_completer_file_name_break_characters) == text_len) - fn_list = make_source_files_completion_list (text, text); + fn_list = make_source_files_completion_list (text); } n_syms = VEC_length (char_ptr, list); diff --git a/gdb/symtab.c b/gdb/symtab.c index def556b..201fa82 100644 --- a/gdb/symtab.c +++ b/gdb/symtab.c @@ -4682,7 +4682,7 @@ maybe_add_partial_symtab_filename (const char *filename, const char *fullname, NULL. */ VEC (char_ptr) * -make_source_files_completion_list (const char *text, const char *word) +make_source_files_completion_list (const char *text) { struct symtab *s; struct objfile *objfile; @@ -4711,7 +4711,7 @@ make_source_files_completion_list (const char *text, const char *word) { /* This file matches for a completion; add it to the current list of matches. */ - add_filename_to_list (s->filename, text, word, &list); + add_filename_to_list (s->filename, text, text, &list); } else { @@ -4723,13 +4723,13 @@ make_source_files_completion_list (const char *text, const char *word) if (base_name != s->filename && !filename_seen (filename_seen_cache, base_name, 1) && filename_ncmp (base_name, text, text_len) == 0) - add_filename_to_list (base_name, text, word, &list); + add_filename_to_list (base_name, text, text, &list); } } datum.filename_seen_cache = filename_seen_cache; datum.text = text; - datum.word = word; + datum.word = text; datum.text_len = text_len; datum.list = &list; map_partial_symbol_filenames (maybe_add_partial_symtab_filename, &datum,