From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2647 invoked by alias); 8 Mar 2011 18:39:56 -0000 Received: (qmail 2582 invoked by uid 22791); 8 Mar 2011 18:39:55 -0000 X-SWARE-Spam-Status: No, hits=-0.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_WEB,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout23.012.net.il (HELO mtaout23.012.net.il) (80.179.55.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Mar 2011 18:39:48 +0000 Received: from conversion-daemon.a-mtaout23.012.net.il by a-mtaout23.012.net.il (HyperSendmail v2007.08) id <0LHR00300544QU00@a-mtaout23.012.net.il>; Tue, 08 Mar 2011 20:39:44 +0200 (IST) Received: from HOME-C4E4A596F7 ([77.124.58.59]) by a-mtaout23.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0LHR003CA566QW00@a-mtaout23.012.net.il>; Tue, 08 Mar 2011 20:39:44 +0200 (IST) Date: Tue, 08 Mar 2011 18:49:00 -0000 From: Eli Zaretskii Subject: Re: [patch libiberty include]: Add additional helper functions for directory-separator searching In-reply-to: <201103081333.03177.pedro@codesourcery.com> To: Pedro Alves Cc: gdb-patches@sourceware.org, ktietz70@googlemail.com, gcc-patches@gcc.gnu.org, binutils@sourceware.org Reply-to: Eli Zaretskii Message-id: <838vwph30i.fsf@gnu.org> References: <201103081243.34340.pedro@codesourcery.com> <201103081333.03177.pedro@codesourcery.com> X-IsSubscribed: yes 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 X-SW-Source: 2011-03/txt/msg00555.txt.bz2 > From: Pedro Alves > Date: Tue, 8 Mar 2011 13:33:02 +0000 > Cc: Kai Tietz , > gcc-patches@gcc.gnu.org, > Eli Zaretskii , > binutils@sourceware.org > > On Tuesday 08 March 2011 12:48:11, Kai Tietz wrote: > > > Well, a better example is elfstab_offset_sections() in elfread.c. > > /* The ELF symbol info doesn't include path names, so strip the path > (if any) from the psymtab filename. */ > while (0 != (p = strchr (filename, '/'))) > filename = p + 1; > > Looks like its looking for the last path separator, so > it might as well use filename_dirrchr instead. Exactly. > > Another is in find_file_and_directory() in dwarf2read.c file. > > Workaround for Irix. Certainly that '/' should not depend > on the host gdb is running on. It actually should use IS_ABSOLUTE_FILE_NAME, if any portability enhancement is needed here. In my experience, the strchr analog is not needed, only the strrchr one (which could be used quite a lot). The few places that use strchr now should actually be rewritten to search from the end, because that's what they need.