On Wed, Mar 26, 2014 at 7:18 PM, Duy Nguyen <pclouds@xxxxxxxxx> wrote: > On Thu, Mar 27, 2014 at 2:22 AM, Eric Sunshine <sunshine@xxxxxxxxxxxxxx> wrote: >>> static void show_dir_entry(const char *tag, struct dir_entry *ent) >>> { >>> + static struct strbuf sb = STRBUF_INIT; >>> int len = max_prefix_len; >>> >>> if (len >= ent->len) >>> @@ -67,8 +79,10 @@ static void show_dir_entry(const char *tag, struct dir_entry *ent) >>> if (!dir_path_match(ent, &pathspec, len, ps_matched)) >>> return; >>> >>> - fputs(tag, stdout); >>> - write_name(ent->name); >>> + strbuf_reset(&sb); >>> + strbuf_addstr(&sb, tag); >>> + write_name(&sb, ent->name); >>> + strbuf_fputs(&sb, stdout); >> >> strbuf_release(&sb); > > Not strictly necessary because sb is static and will be reset at the > next call. I just want to lower the number of allocation (write_name > allocates some more). It may be a premature optimization though. Ah, yes. I noted the 'static' on my initial read-through but had forgotten about it by the time I finally got to a computer with which I could send plain-text email. Sorry for the noise. > The same for changes in show_ce_entry(). > -- > 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