From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by dcvr.yhbt.net (Postfix) with ESMTP id 113F11F5AE for ; Fri, 24 Jul 2020 19:40:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726572AbgGXTkD (ORCPT ); Fri, 24 Jul 2020 15:40:03 -0400 Received: from pb-smtp2.pobox.com ([64.147.108.71]:63199 "EHLO pb-smtp2.pobox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726085AbgGXTkC (ORCPT ); Fri, 24 Jul 2020 15:40:02 -0400 Received: from pb-smtp2.pobox.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id DA9AF86CD5; Fri, 24 Jul 2020 15:39:59 -0400 (EDT) (envelope-from junio@pobox.com) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=4bWrbKPU+GZey4XmLxH6iXrjH20=; b=mUh6ns vdBeUvZCO4l1m2Y/qGQKhNhffh3aEz7omOAJ9fIaH+dgkF8Ljl1L2VbVdpmDzbHZ S8cRPEjBqI0s7/kGhue+R11sTROYhshGzxtiMuk0XOYJLLMFQ76TJ/4bglnJ/rqV VdXCKJWJ7DIiyUX8yt4aBxxatKJ/DQ5/Sys8k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=ZegqGWIju8g5P7kAk1qiH1QexFCFRVm/ KhAszHOehkg8WWTYF0b9yDNkd+HJCPbrhAMDshPse1o0d6Z7S9KBnf3lupLkqpvg KVZWOSneAAmRH/DNpmVMdbYM3hnKvuR1QfYW0KKCZGY8epEuFee0wusPvewbUFz2 Wn8ZHtK2c+U= Received: from pb-smtp2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-smtp2.pobox.com (Postfix) with ESMTP id CE1BF86CD4; Fri, 24 Jul 2020 15:39:59 -0400 (EDT) (envelope-from junio@pobox.com) Received: from pobox.com (unknown [35.196.173.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pb-smtp2.pobox.com (Postfix) with ESMTPSA id 5B98586CD3; Fri, 24 Jul 2020 15:39:59 -0400 (EDT) (envelope-from junio@pobox.com) From: Junio C Hamano To: Derrick Stolee Cc: Derrick Stolee via GitGitGadget , git@vger.kernel.org, Johannes.Schindelin@gmx.de, sandals@crustytoothpaste.net, steadmon@google.com, jrnieder@gmail.com, peff@peff.net, congdanhqx@gmail.com, phillip.wood123@gmail.com, emilyshaffer@google.com, sluongng@gmail.com, jonathantanmy@google.com, Derrick Stolee , Derrick Stolee Subject: Re: [PATCH v2 04/18] maintenance: initialize task array References: <8e260bccf1a0b6cd799a6bc78798b31ebed8ad7e.1595527000.git.gitgitgadget@gmail.com> <1501583a-0fb0-ad88-bd2f-4f64c3c66980@gmail.com> <67e49b30-9a7f-8c18-3a06-96c516027c7a@gmail.com> Date: Fri, 24 Jul 2020 12:39:58 -0700 In-Reply-To: <67e49b30-9a7f-8c18-3a06-96c516027c7a@gmail.com> (Derrick Stolee's message of "Fri, 24 Jul 2020 08:51:32 -0400") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: 75B18202-CDE5-11EA-83C9-2F5D23BA3BAF-77302942!pb-smtp2.pobox.com Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Derrick Stolee writes: > 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.