From: David Turner Date: Mon, 17 Nov 2014 20:35:28 GMT Subject: Re: [PATCH v2 02/22] untracked cache: record .gitignore information and dir hierarchy Message-ID: <1416256528.9065.14.camel@leckie> In-Reply-To: <1415439595-469-3-git-send-email-pclouds@gmail.com> On Sat, 2014-11-08 at 16:39 +0700, Nguyễn Thái Ngọc Duy wrote: > + d = xmalloc(sizeof(*d) + len); > + memset(d, 0, sizeof(*d) + len); >+ memcpy(d->name, name, len); calloc instead of malloc+memset? But do we really need this memset to include name if we're about to use a memcpy? Couldn't we just add a trailing zero? > + * - The list of files and directories of the direction in question s/direction/directory/ > +struct untracked_cache_dir { > + struct untracked_cache_dir **dirs; > + char **untracked; > + struct stat_data stat_data; > + unsigned int untracked_alloc, dirs_nr, dirs_alloc; > + unsigned int untracked_nr; > + unsigned int check_only : 1; > + /* null SHA-1 means this directory does not have .gitignore */ > + unsigned char exclude_sha1[20]; > + char name[1]; For consistency, should this be char name[FLEX_ARRAY]? (this will entail some changes when allocating these, of course)