Re: [PATCH v2 02/22] untracked cache: record .gitignore information and dir hierarchy
- From
David Turner <dturner@twopensource.com>
- Date
- Nov 17, 2014, 20:35 UTC
- 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/
Show 10 quoted lines
> +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)