On Thu, Feb 20, 2014 at 3:17 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote: >> + strbuf_setlen(sb, len); >> + strbuf_add(sb, s, strlen(s)); > > I am not sure addstr_at() gives us a good abstraction, or at least > the name conveys what it does well not to confuse readers. > > At first after only seeing its name, I would have expected that it > would splice the given string into an existing strbuf at the > location, not chopping the existing strbuf at the location and > appending. I think I invented a few new strbuf_* in this series and this is one of them. We have about ~14 other places in current code that do similar pattern: set length back, then add something on top. Not sure if it's worth a convenient wrapper. I don't know, maybe it's not worth reducing one line and causing more confusion. > >> +} >> static inline void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2) { >> strbuf_grow(sb, sb2->len); >> strbuf_add(sb, sb2->buf, sb2->len); -- Duy -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html