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-ASN: AS53758 23.128.96.0/24 X-Spam-Status: No, score=-4.2 required=3.0 tests=AWL,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS,UNWANTED_LANGUAGE_BODY 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 742421F8C8 for ; Mon, 27 Sep 2021 06:38:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232821AbhI0Gjc (ORCPT ); Mon, 27 Sep 2021 02:39:32 -0400 Received: from bsmtp1.bon.at ([213.33.87.15]:6553 "EHLO bsmtp1.bon.at" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233013AbhI0Gja (ORCPT ); Mon, 27 Sep 2021 02:39:30 -0400 Received: from [192.168.0.98] (unknown [93.83.142.38]) by bsmtp1.bon.at (Postfix) with ESMTPSA id 4HHtHL5GbCz5tlH; Mon, 27 Sep 2021 08:37:50 +0200 (CEST) Subject: Re: [PATCH 5/5] cbtree.h: define cb_init() in terms of CBTREE_INIT To: =?UTF-8?B?w4Z2YXIgQXJuZmrDtnLDsCBCamFybWFzb24=?= Cc: Junio C Hamano , Jeff King , =?UTF-8?Q?Martin_=c3=85gren?= , git@vger.kernel.org References: From: Johannes Sixt Message-ID: <694f477d-b387-c8ea-4138-0e9334540c69@kdbg.org> Date: Mon, 27 Sep 2021 08:37:50 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Am 27.09.21 um 02:39 schrieb Ævar Arnfjörð Bjarmason: > --- a/cbtree.h > +++ b/cbtree.h > @@ -37,11 +37,12 @@ enum cb_next { > CB_BREAK = 1 > }; > > -#define CBTREE_INIT { .root = NULL } > +#define CBTREE_INIT { 0 } > > static inline void cb_init(struct cb_tree *t) > { > - t->root = NULL; > + struct cb_tree blank = CBTREE_INIT; This could be static const struct cb_tree blank = CBTREE_INIT; > + memcpy(t, &blank, sizeof(*t)); Is *t = blank; not a thing in C? -- Hannes