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

Tom Tromey
2019-09-10T15:15:24Z

>>>>> "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.

Christian> + for (; IS_DIR_SEPARATOR (file[start]); ++start)
Christian> + continue;

Just omit the "continue" and leave a bare ";".

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".

Christian> + std::string relocated_sysgdbinit =
Christian> + relocate_gdbinit_path_maybe_in_datadir (SYSTEM_GDBINIT);

"=" at start of continuation line.

Tom