Re: [PATCH v2 02/22] untracked cache: record .gitignore information and dir hierarchy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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)


--
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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]