Re: [PATCH v2 04/18] maintenance: initialize task array
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jul 24, 2020, 19:39 UTC
- Message-ID
- <xmqq365gn1m9.fsf@gitster.c.googlers.com>
- In-Reply-To
- <67e49b30-9a7f-8c18-3a06-96c516027c7a@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 21 quoted lines
> OK, my attempt has led to this final table:
>
> const struct maintenance_task default_tasks[] = {
> {
> "prefetch",
> maintenance_task_prefetch,
> },
>...
> {
> "commit-graph",
> maintenance_task_commit_graph,
> should_write_commit_graph,
> }
> };
> num_tasks = sizeof(default_tasks) / sizeof(struct maintenance_task);
>
> This is followed by allocating and copying the data to the
> 'tasks' array, allowing it to be sorted and modified according
> to command-line arguments and config.
>
> Is this what you intended?I do not know how important it is for your overall design to keep the blueprint/master-copy table that is separate from the working copy of the table that gets sorted, enabled/chosen bit set, etc. IIUC, you were modifying the entries' fields at runtime, so perhaps a pristine copy is not all that important (in which case you can just lose "const" and do without extra copying)? I dunno.