From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 50921 invoked by alias); 10 Sep 2019 19:14:52 -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 50909 invoked by uid 89); 10 Sep 2019 19:14:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.3 required=5.0 tests=AWL,BAYES_00,ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_PASS,USER_IN_DEF_SPF_WL autolearn=ham version=3.3.1 spammy=HX-HELO:sk:mail-oi, HX-Spam-Relays-External:sk:mail-oi, H*RU:sk:mail-oi, H*r:sk:mail-oi X-HELO: mail-oi1-f195.google.com Received: from mail-oi1-f195.google.com (HELO mail-oi1-f195.google.com) (209.85.167.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 10 Sep 2019 19:14:51 +0000 Received: by mail-oi1-f195.google.com with SMTP id 7so12092390oip.5 for ; Tue, 10 Sep 2019 12:14:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=WrJX3Qo3PTgOhUq7zSa1mD7P1LTcmptpdp9+VAUaJxw=; b=vqlET+cZLy3riODujLlIDi4TuXTFMzwqboz03u47wCzFnF3IAY0YhyYsb86Uv2qz4U 2mOLPc7qKNf9albjI9BxV7dNoTVPmb0rRAFSnFWtzRvZx5TT3mQT9nFITmFWdT2UeaJi AaYSUsOfDrmmYcAwZLDSRODcfF+c7EifrjFBulCGbvAJIEVoN+4JFt6UzoTPOfyFPqrx P/H9xF2Hqjlu2XmYEKSYNjW8mf6m6ZTBMggmy2x5QqggCx0lcUncTtCfyQNGrQpGpeT4 H4vL9YvZ5PYMD3pAZZSPSM7tlr4acWl+QcgWLPLGEhC2jvn4zcJsKerDlVmryqshcOh4 +2OQ== MIME-Version: 1.0 References: <20190909180830.215313-1-cbiesinger@google.com> <20190909180830.215313-3-cbiesinger@google.com> <87k1ag6v4b.fsf@tromey.com> In-Reply-To: <87k1ag6v4b.fsf@tromey.com> From: "Christian Biesinger via gdb-patches" Reply-To: Christian Biesinger Date: Tue, 10 Sep 2019 19:14:00 -0000 Message-ID: Subject: Re: [PATCH 2/3] Factor out the code to do the datadir-relocation for gdbinit To: Tom Tromey Cc: Christian Biesinger via gdb-patches Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes X-SW-Source: 2019-09/txt/msg00188.txt.bz2 On Tue, Sep 10, 2019 at 10:15 AM Tom Tromey wrote: > > >>>>> "Christian" == Christian Biesinger via gdb-patches writes: > > Christian> This simplifies get_init_files and makes it possible to reuse > Christian> this code in an upcoming patch for SYSTEM_GDBINIT_DIR. > > > Christian> +static std::string > Christian> +relocate_gdbinit_path_maybe_in_datadir (const std::string& file) > Christian> +{ > > New functions should have an introductory comment. Done. > Christian> + for (; IS_DIR_SEPARATOR (file[start]); ++start) > Christian> + continue; > > Just omit the "continue" and leave a bare ";". Done. > Christian> + relocated_path = std::string (gdb_datadir) + SLASH_STRING + > Christian> + file.substr(start); > > This needs parens on the RHS and should be indented differently. > Also, space before the "(" after "substr". Done. > Christian> + std::string relocated_sysgdbinit = > Christian> + relocate_gdbinit_path_maybe_in_datadir (SYSTEM_GDBINIT); > > "=" at start of continuation line. Done.