Re: [PATCH v3 2/6] path.c: new (identical) list for worktree v1

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

 



Nguyễn Thái Ngọc Duy  <pclouds@xxxxxxxxx> writes:

> +static struct common_dir common_list_v1[] = {
> +	...
> +};
> +
> +static struct common_dir *get_common_list(void)
> +{
> +	switch (repository_format_worktree_version) {
> +	case 0: return common_list_v0;
> +	case 1: return common_list_v1;

Why not an array whose elements are these common_list_v$N[]
instead of "switch"?  I.e.

static struct common_dir **common_list_version[] = {
	common_list_v0,
        common_list_v1,
};

static struct common_dir *get_common_list(void)
{
	int i = repository_format_worktree_version;
	if (i < ARRAY_SIZE(common_list_version))
		return common_list_version[i];
	die("I dunno about version %d", i);
}

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