public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin-developers@cygwin.com
Subject: Re: Coding style question for Corinna
Date: Fri, 13 Nov 2020 10:22:06 +0100	[thread overview]
Message-ID: <20201113092206.GT33165@calimero.vinschen.de> (raw)
In-Reply-To: <Pine.BSF.4.63.2011122152520.95690@m0.truegem.net>

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

      reply	other threads:[~2020-11-13  9:22 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-13  6:02 Mark Geisert
2020-11-13  9:22 ` Corinna Vinschen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201113092206.GT33165@calimero.vinschen.de \
    --to=corinna-cygwin@cygwin.com \
    --cc=cygwin-developers@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).