diff mbox series

[5/6] Revert "sequencer: allow callers of read_author_script() to ignore fields"

Message ID 20200407141125.30872-6-phillip.wood123@gmail.com (mailing list archive)
State New, archived
Headers show
Series fixup ra/rebase-i-more-options | expand

Commit Message

Phillip Wood April 7, 2020, 2:11 p.m. UTC
From: Phillip Wood <phillip.wood@dunelm.org.uk>

This reverts commit c068bcc59b4f16322a77b6a47b53d44b05c51fec.

This functionality is no longer used as since the last commit we always
want all of the fields returned.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
---
 sequencer.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)

Comments

Elijah Newren April 7, 2020, 3:06 p.m. UTC | #1
On Tue, Apr 7, 2020 at 7:11 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
>
> From: Phillip Wood <phillip.wood@dunelm.org.uk>
>
> This reverts commit c068bcc59b4f16322a77b6a47b53d44b05c51fec.
>
> This functionality is no longer used as since the last commit we always
> want all of the fields returned.

That's a little hard to parse.  Maybe s/used as since/used; since/ ?

>
> Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
> ---
>  sequencer.c | 16 +++-------------
>  1 file changed, 3 insertions(+), 13 deletions(-)
>
> diff --git a/sequencer.c b/sequencer.c
> index 56f6e49289..17c7b18245 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -825,19 +825,9 @@ int read_author_script(const char *path, char **name, char **email, char **date,
>                 error(_("missing 'GIT_AUTHOR_DATE'"));
>         if (date_i < 0 || email_i < 0 || date_i < 0 || err)
>                 goto finish;
> -
> -       if (name)
> -               *name = kv.items[name_i].util;
> -       else
> -               free(kv.items[name_i].util);
> -       if (email)
> -               *email = kv.items[email_i].util;
> -       else
> -               free(kv.items[email_i].util);
> -       if (date)
> -               *date = kv.items[date_i].util;
> -       else
> -               free(kv.items[date_i].util);
> +       *name = kv.items[name_i].util;
> +       *email = kv.items[email_i].util;
> +       *date = kv.items[date_i].util;
>         retval = 0;
>  finish:
>         string_list_clear(&kv, !!retval);
> --
> 2.26.0
>
diff mbox series

Patch

diff --git a/sequencer.c b/sequencer.c
index 56f6e49289..17c7b18245 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -825,19 +825,9 @@  int read_author_script(const char *path, char **name, char **email, char **date,
 		error(_("missing 'GIT_AUTHOR_DATE'"));
 	if (date_i < 0 || email_i < 0 || date_i < 0 || err)
 		goto finish;
-
-	if (name)
-		*name = kv.items[name_i].util;
-	else
-		free(kv.items[name_i].util);
-	if (email)
-		*email = kv.items[email_i].util;
-	else
-		free(kv.items[email_i].util);
-	if (date)
-		*date = kv.items[date_i].util;
-	else
-		free(kv.items[date_i].util);
+	*name = kv.items[name_i].util;
+	*email = kv.items[email_i].util;
+	*date = kv.items[date_i].util;
 	retval = 0;
 finish:
 	string_list_clear(&kv, !!retval);