]> granicus.if.org Git - git/commitdiff
Merge branch 'nd/dir-prep-exclude-cleanup'
authorJunio C Hamano <gitster@pobox.com>
Fri, 24 Oct 2014 22:00:05 +0000 (15:00 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 24 Oct 2014 22:00:05 +0000 (15:00 -0700)
Code clean-up.

* nd/dir-prep-exclude-cleanup:
  dir.c: remove the second declaration of "stk" in prep_exclude()

1  2 
dir.c

diff --cc dir.c
index bd274a73f1faaee40bce34024ef17bfd44fbcad7,c2a1c87f4969531bbb8ee2830fc639dc7fa89811..3f7a0256b61552c6c3f80f710bd042b697d79da9
--- 1/dir.c
--- 2/dir.c
+++ b/dir.c
@@@ -814,21 -813,12 +814,21 @@@ static void prep_exclude(struct dir_str
        if (dir->exclude)
                return;
  
 +      /*
 +       * Lazy initialization. All call sites currently just
 +       * memset(dir, 0, sizeof(*dir)) before use. Changing all of
 +       * them seems lots of work for little benefit.
 +       */
 +      if (!dir->basebuf.buf)
 +              strbuf_init(&dir->basebuf, PATH_MAX);
 +
        /* Read from the parent directories and push them down. */
        current = stk ? stk->baselen : -1;
 +      strbuf_setlen(&dir->basebuf, current < 0 ? 0 : current);
        while (current < baselen) {
-               struct exclude_stack *stk = xcalloc(1, sizeof(*stk));
                const char *cp;
  
+               stk = xcalloc(1, sizeof(*stk));
                if (current < 0) {
                        cp = base;
                        current = 0;