All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Denton Liu <liu.denton@gmail.com>
Cc: Git Mailing List <git@vger.kernel.org>,
	Elijah Newren <newren@gmail.com>,
	Philip Oakley <philipoakley@iee.email>
Subject: Re: [PATCH 2/2] notes: break set_display_notes() into smaller functions
Date: Wed, 18 Dec 2019 11:18:10 -0500	[thread overview]
Message-ID: <CAPig+cRVyfWceVZFgRuRyL-B3TMnX9fObC84t2LHsNoXm8TuqQ@mail.gmail.com> (raw)
In-Reply-To: <96b908c91c19bc11da9f8d3b0d6e853517284540.1576111643.git.liu.denton@gmail.com>

On Wed, Dec 11, 2019 at 7:48 PM Denton Liu <liu.denton@gmail.com> wrote:
> In 8164c961e1 (format-patch: use --notes behavior for format.notes,
> 2019-12-09), we introduced set_display_notes() which was a monolithic
> function with three mutually exclusive branches. Break the function up
> into three small and simple functions that each are only responsible for
> one task.
> [...]
> Signed-off-by: Denton Liu <liu.denton@gmail.com>
> ---
> diff --git a/notes.c b/notes.c
> @@ -1045,28 +1045,31 @@ void init_display_notes(struct display_notes_opt *opt)
> +void disable_display_notes(struct display_notes_opt *opt, int *show_notes)
> +{
> +       opt->use_default_notes = -1;
> +       /* we have been strdup'ing ourselves, so trick
> +        * string_list into free()ing strings */

    /*
     * Multi-line comment
     * style.
     */

Though, apparently the formatting used here predates your changes; you
simply moved the code (and comment) around.

> +       opt->extra_notes_refs.strdup_strings = 1;
> +       string_list_clear(&opt->extra_notes_refs, 0);
> +       opt->extra_notes_refs.strdup_strings = 0;
> +       *show_notes = 0;
>  }
> diff --git a/notes.h b/notes.h
> @@ -266,14 +266,19 @@ struct display_notes_opt {
>  /*
> + * This family of functions enables or disables the display of notes. In
> + * particular, 'enable_default_display_notes' will display the default notes,
> + * 'enable_default_display_notes' will display the notes ref 'ref' and

s/enable_default_display_notes/enable_ref_display_notes/

> + * 'disable_display_notes' will disable notes, including those added by previous
> + * invocations of the 'enable_*_display_notes' functions.
> + *
> + * 'show_notes' is a points to a boolean which will be set to 1 if notes are

s/points/pointer/

> + * displayed, else 0. It must not be NULL.
>   */

  reply	other threads:[~2019-12-18 16:18 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-12  0:49 [PATCH 0/2] dl/format-patch-notes-config-fixup: clean up some leftoverbits Denton Liu
2019-12-12  0:49 ` [PATCH 1/2] config/format.txt: clarify behavior of multiple format.notes Denton Liu
2019-12-12  0:49 ` [PATCH 2/2] notes: break set_display_notes() into smaller functions Denton Liu
2019-12-18 16:18   ` Eric Sunshine [this message]
2019-12-18 18:17     ` [PATCH] notes.h: fix typos in comment Denton Liu

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=CAPig+cRVyfWceVZFgRuRyL-B3TMnX9fObC84t2LHsNoXm8TuqQ@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=liu.denton@gmail.com \
    --cc=newren@gmail.com \
    --cc=philipoakley@iee.email \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.