Re: [PATCHv2 1/3] gdb: refactor the initialization file lookup code

Simon Marchi via Gdb-patches
2021-01-26T15:10:02Z

On 2021-01-26 4:48 a.m., Andrew Burgess wrote:
> +static void
> +get_init_files (std::vector<std::string> *system_gdbinit,
> + std::string *home_gdbinit,
> + std::string *local_gdbinit)
> +{
> + /* Cache the file lookup object so we only actually search for the files
> + once. */
> + static std::unique_ptr<gdb_initfile_finder> init_files;
> + if (init_files == nullptr)
> + init_files = std::unique_ptr<gdb_initfile_finder>
> + (new gdb_initfile_finder (GDBINIT,

Just a nit, but I'd use an optional instead of a unique_ptr here, just
because we don't need dynamic allocation.

Otherwise, LGTM.

Simon