From: Junio C Hamano Date: Fri, 24 Oct 2014 22:00:05 +0000 (-0700) Subject: Merge branch 'nd/dir-prep-exclude-cleanup' X-Git-Tag: v2.2.0-rc0~18 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=1758d236a253c10f34ae16cd2ae6d9c57eb312a7;p=thirdparty%2Fgit.git Merge branch 'nd/dir-prep-exclude-cleanup' Code clean-up. * nd/dir-prep-exclude-cleanup: dir.c: remove the second declaration of "stk" in prep_exclude() --- 1758d236a253c10f34ae16cd2ae6d9c57eb312a7 diff --cc dir.c index bd274a73f1,c2a1c87f49..3f7a0256b6 --- a/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;