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