From: Junio C Hamano Date: Sat, 13 Oct 2018 08:05:18 GMT Subject: Re: [PATCH v3 4/7] revision.c: begin refactoring --topo-order logic Message-ID: In-Reply-To: Johannes Sixt writes: > Am 12.10.18 um 08:33 schrieb Junio C Hamano: >> "Derrick Stolee via GitGitGadget" writes: >>> +struct topo_walk_info {}; >>> + >>> +static void init_topo_walk(struct rev_info *revs) >>> +{ >>> + struct topo_walk_info *info; >>> + revs->topo_walk_info = xmalloc(sizeof(struct topo_walk_info)); >>> + info = revs->topo_walk_info; >>> + memset(info, 0, sizeof(struct topo_walk_info)); >> >> There is no member in the struct at this point. Are we sure this is >> safe? Just being curious. > > sizeof cannot return 0. sizeof(struct topo_walk_info) will be 1 here. Thanks.