From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by sourceware.org (Postfix) with ESMTPS id 860DF3A19821 for ; Fri, 13 Nov 2020 09:22:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 860DF3A19821 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=cygwin.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=corinna-cygwin@cygwin.com Received: from calimero.vinschen.de ([24.134.7.25]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MSLEm-1kk4rX0Ho8-00SbzX for ; Fri, 13 Nov 2020 10:22:07 +0100 Received: by calimero.vinschen.de (Postfix, from userid 500) id 8DEBEA80D89; Fri, 13 Nov 2020 10:22:06 +0100 (CET) Date: Fri, 13 Nov 2020 10:22:06 +0100 From: Corinna Vinschen To: cygwin-developers@cygwin.com Subject: Re: Coding style question for Corinna Message-ID: <20201113092206.GT33165@calimero.vinschen.de> Reply-To: cygwin-developers@cygwin.com Mail-Followup-To: cygwin-developers@cygwin.com References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Provags-ID: V03:K1:aiIsDMpuxXD27/nB8V5fTSXyvwAWkmeBIhOyl7+9xWs42jr0Xpo PSeoEz0iFoHIWllTR7vpyVvmKVKN1yP1fwdXfol4bLjxviX62uTexG9Qrw6IkfrnLuUR7CS DP1jEpSyP/f3B4agoGxjCIQl6A4HvRZVn9ZrZM8+V++sawIl9e8aIHfVMHVGJmJ6JE12Rvt t6I/MQVrJhsBuVG/bW92A== X-UI-Out-Filterresults: notjunk:1;V03:K0:+wjkQxTottM=:Y84oxkUxERqYrhsskB+cjB fr1bGCIHowR8bn5S0umVeKIfb4D2EJ6DhLixK173pCngJal05OtZEVf3cuAM5dE6JspL7LNZe 8Ag630NjAgesJwkKjO3ciQkqLfOP/IoJJ+60rQTbcrpXoqr9oqwEi2iqvVaXsbKFNJKNYlVuY wYkKmYgXge/mbJ4NUXTNAX33iy1Z8FAHN9aCgQLjw+ouqCGDmrkq5H9vXLCcuq7J+WZe91Ap8 go92e1n0nQ+VT8tJPh/enpGAm3vwykk1nI5mUqjRgoXSwD+CT+cgrvEHM9H38C1kY6NPU7rso DQtY9yfHI/qpT0jRhF93xmAtIQ7qSOCtTXJXS3w9KE1GO9Fbv7TNpToWWo2c8hB4S2NstjwY7 yGF+mHb9jOmIwXEQWyiHfC5qyAfhsb8O4mvRFYLzZYEnm7JGsa08jxa1sXLpCozpmEZcBsyRj T6igBUMXfQ== X-Spam-Status: No, score=-100.8 required=5.0 tests=BAYES_00, GOOD_FROM_CORINNA_CYGWIN, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NEUTRAL, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-developers@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin core component developers mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 09:22:09 -0000 Hi Mark, On Nov 12 22:02, Mark Geisert wrote: > Hi Corinna, > I'm about to submit the patches for a small improvement to Cygwin's malloc > implementation. There are several places in malloc_wrapper.cc where I have > minor code repetition inside an #if. But it could be coded differently.. so > which of the following forms do you prefer? > --- form 1 --- > if (!use_internal) > user_data->free (p); > else > { > #if MSPACES > void *m = get_current_mspace (); > if (likely(m)) ^^^ missing space > mspace_free (m, p); > else > dlfree (p); > #else > dlfree (p); > #endif > } > > --- form 2 --- > if (!use_internal) > user_data->free (p); > else > { > #if MSPACES > void *m = get_current_mspace (); > if (likely(m)) > mspace_free (m, p); > else > #endif > dlfree (p); > } > > Thanks, > > ..mark We have a couple of form 2 in the code, but I'd prefer form 1 these days. However, you're doing the coding and both forms are correct, so it's your choice in the first place. Corinna