Re: [PATCH 2/4] am: convert "resume" variable to a struct
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 19, 2020, 19:19 UTC
- Message-ID
- <xmqqv9o2e66q.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20200219161352.13562-3-pbonzini@redhat.com>
pbonzini@redhat.com writes:
Show 41 quoted lines
> From: Paolo Bonzini <pbonzini@redhat.com>
>
> This will allow stashing the submode of --show-current-patch. Using
> a struct will allow accessing both fields from outside cmd_am (through
> container_of).
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> builtin/am.c | 32 ++++++++++++++++++--------------
> 1 file changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/builtin/am.c b/builtin/am.c
> index 8181c2aef3..a89e1a96ed 100644
> --- a/builtin/am.c
> +++ b/builtin/am.c
> @@ -2118,7 +2118,7 @@ static int parse_opt_patchformat(const struct option *opt, const char *arg, int
> return 0;
> }
>
> -enum resume_mode {
> +enum resume_type {
> RESUME_FALSE = 0,
> RESUME_APPLY,
> RESUME_RESOLVED,
> @@ -2128,6 +2128,10 @@ enum resume_mode {
> RESUME_SHOW_PATCH
> };
>
> +struct resume_mode {
> + enum resume_type mode;
> +};
> +
> static int git_am_config(const char *k, const char *v, void *cb)
> {
> int status;
> @@ -2145,7 +2149,7 @@ int cmd_am(int argc, const char **argv, const char *prefix)
> int binary = -1;
> int keep_cr = -1;
> int patch_format = PATCH_FORMAT_UNKNOWN;
> - enum resume_mode resume = RESUME_FALSE;
> + struct resume_mode resume = { . mode = RESUME_FALSE };I do not think it makes a difference to compilers, but it seems that existing code spells this without SP between dot and the field name.
> + struct resume_mode resume = { .mode = RESUME_FALSE };The rest of the patch is quite straight-forward update that looks correct.
Thanks.