Re: [PATCH v3 4/7] revision.c: begin refactoring --topo-order logic
Johannes Sixt <j6t@kdbg.org> writes:
Show 15 quoted lines
> Am 12.10.18 um 08:33 schrieb Junio C Hamano:
>> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> 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.