From: Junio C Hamano Date: Wed, 27 Jan 2016 22:18:00 GMT Subject: Re: [PATCH v3 2/6] path.c: new (identical) list for worktree v1 Message-ID: In-Reply-To: <1453808685-21235-3-git-send-email-pclouds@gmail.com> Nguyễn Thái Ngọc Duy 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); }