Re: [PATCH v2 00/10] port branch.c to use ref-filter's printing options
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Oct 8, 2015, 18:26 UTC
- Message-ID
- <vpqoag9nrna.fsf@grenoble-inp.fr>
- In-Reply-To
- <CAOLa=ZQOO9BjoTj1B-b=kUviL=617F7y46BeX1sOXpeHcatFVQ@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 13 quoted lines
> On Thu, Oct 8, 2015 at 10:40 PM, Matthieu Moy > <Matthieu.Moy@grenoble-inp.fr> wrote: > >> This particular piece of code is so important and I won't fight for a >> better factored one, but in general "there are only two instances" is a >> dubious argument to avoid refactoring. >> >> Still, I find it weird to force the nobracket to be always at the same >> position. >> > > No i mean I could follow up with the way we use it in align, but I don't see > how I can make a function out of this.
Ah, OK. Well, there are already two instances of
/* Strip trailing comma */ if (s[1]) strbuf_setlen(s[0], s[0]->len - 1);
(for objectname and align), one of which says
/* * TODO: Implement a function similar to strbuf_split_str() * which would omit the separator from the end of each value. */
I guess it's time to replace this TODO with actual code. A straightforward implementation would be to call strbuf_split_str and then use the same "if (s[1])" as you already have. There's probably a more efficient way.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/