Re: [PATCH 1/5] Introduce build_debug_file_name

Gary Benson
2015-07-02T13:53:27Z

Pedro Alves wrote:
> On 07/02/2015 12:18 PM, Gary Benson wrote:
> > Pedro Alves wrote:
> > > On 06/16/2015 10:42 AM, Gary Benson wrote:
> > > > This commit introduces a new function build_debug_file_name
> > > > which concatenates a series of filename components into a
> > > > filename. find_separate_debug_file is updated to use
> > > > build_debug_file_name. A later commit in this series will
> > > > extend build_debug_file_name to correctly handle "target:"
> > > > prefixes, so it is convenient to have filename building pulled
> > > > out into one function. For now the only functional change
> > > > here is that the original code sometimes generated filenames
> > > > with repeated directory separators while the new code does
> > > > not.
> > >
> > > I'd drop the "debug" from the function's name. Sounds like a
> > > candidate for reuse elsewhere to me.
> >
> > Should I put it somewhere else, maybe common-utils.c?
>
> I dislike common-utils.c for "kitchen-sink" reasons, though.
>
> There's common/filestuff.c, but that looks more for low/OS level
> file things.

Yeah, that was my first thought.

> There's substitute_path_component (and gdb_realpath / gdb_abspath)
> in utils.c. Maybe put it next to substitute_path_component, which
> seems to be in the same "family" of function, and then (at some
> point) we would move all file name/path manipulation routines to its
> own file.
>
> WDYT?

Suits me :)

Cheers,
Gary

--