Re: [PATCH 2/3] Factor out the code to do the datadir-relocation for gdbinit

Christian Biesinger via gdb-patches
2019-09-10T19:14:52Z

On Tue, Sep 10, 2019 at 10:15 AM Tom Tromey <tom@tromey.com> wrote:
>
> >>>>> "Christian" == Christian Biesinger via gdb-patches <gdb-patches@sourceware.org> 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.