Karthik Nayak <karthik....@gmail.com> writes:

> On Thu, Oct 8, 2015 at 10:40 PM, Matthieu Moy
> <matthieu....@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/
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to