On 2026-05-08T13:58:36+0800, Kevin J. McCarthy wrote:
> On Fri, May 08, 2026 at 12:57:09PM +0800, Kevin J. McCarthy wrote:
> > On Fri, May 08, 2026 at 06:08:37AM +0200, Rene Kita wrote:
> > > If we don't care about adding empty strings we could just do (untested):
> > > #v+
> > > void mutt_buffer_concat_path(BUFFER *d, const char *dir, const char
> > > *fname)
> > > {
> > > mutt_buffer_clear(d);
> > > mutt_buffer_addstr(d, dir);
> > >
> > > if (*dir && dir[strlen(dir)-1 != '/')
> > > mutt_buffer_addch(d, '/');
> > > while (*fname && *fname == '/') fname++;
> > > mutt_buffer_addstr(d, fname);
> > > }
> > > #v-
> >
> > I like this version (subject to testing).
>
> Ah, sorry, this version isn't the same, since it inverts the dir trailing
> slash check.
>
> It fails the test: "" + "/baz" => "/baz"
>
> I think fixing it while keeping it concise would just devolve to the same
> logic as with Alex's one line patch. So I vote for just using that one-line
> fix in both the buffer and non-buffer version.Yup, makes sense. If you send the patch including both places, I'll have a look, but I trust that. Cheers, Alex -- <https://www.alejandro-colomar.es>
signature.asc
Description: PGP signature
