[GSoC,v2,4/6] sequencer: rename amend_author to author_to_rename
diff mbox series

Message ID 20190812194301.5655-5-rohit.ashiwal265@gmail.com
State New
Headers show
Series
  • rebase -i: support more options
Related show

Commit Message

Rohit Ashiwal Aug. 12, 2019, 7:42 p.m. UTC
The purpose of amend_author was to free() the malloc()'d string
obtained from get_author() while amending a commit. But we can
also use the variable to free() the author at our convenience.
Rename it to convey this meaning.

Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
---
 sequencer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Phillip Wood Aug. 13, 2019, 1:29 p.m. UTC | #1
Hi Rohit

On 12/08/2019 20:42, Rohit Ashiwal wrote:
> The purpose of amend_author was to free() the malloc()'d string
> obtained from get_author() while amending a commit. But we can
> also use the variable to free() the author at our convenience.
> Rename it to convey this meaning.

Thanks for rewording this

Best Wishes

Phillip

> 
> Signed-off-by: Rohit Ashiwal <rohit.ashiwal265@gmail.com>
> ---
>   sequencer.c | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/sequencer.c b/sequencer.c
> index fbc0ed0cad..e186136ccc 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -1424,7 +1424,7 @@ static int try_to_commit(struct repository *r,
>   	struct commit_extra_header *extra = NULL;
>   	struct strbuf err = STRBUF_INIT;
>   	struct strbuf commit_msg = STRBUF_INIT;
> -	char *amend_author = NULL;
> +	char *author_to_free = NULL;
>   	const char *hook_commit = NULL;
>   	enum commit_msg_cleanup_mode cleanup;
>   	int res = 0;
> @@ -1445,7 +1445,7 @@ static int try_to_commit(struct repository *r,
>   			strbuf_addstr(msg, orig_message);
>   			hook_commit = "HEAD";
>   		}
> -		author = amend_author = get_author(message);
> +		author = author_to_free = get_author(message);
>   		unuse_commit_buffer(current_head, message);
>   		if (!author) {
>   			res = error(_("unable to parse commit author"));
> @@ -1534,7 +1534,7 @@ static int try_to_commit(struct repository *r,
>   	free_commit_extra_headers(extra);
>   	strbuf_release(&err);
>   	strbuf_release(&commit_msg);
> -	free(amend_author);
> +	free(author_to_free);
>   
>   	return res;
>   }
>

Patch
diff mbox series

diff --git a/sequencer.c b/sequencer.c
index fbc0ed0cad..e186136ccc 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -1424,7 +1424,7 @@  static int try_to_commit(struct repository *r,
 	struct commit_extra_header *extra = NULL;
 	struct strbuf err = STRBUF_INIT;
 	struct strbuf commit_msg = STRBUF_INIT;
-	char *amend_author = NULL;
+	char *author_to_free = NULL;
 	const char *hook_commit = NULL;
 	enum commit_msg_cleanup_mode cleanup;
 	int res = 0;
@@ -1445,7 +1445,7 @@  static int try_to_commit(struct repository *r,
 			strbuf_addstr(msg, orig_message);
 			hook_commit = "HEAD";
 		}
-		author = amend_author = get_author(message);
+		author = author_to_free = get_author(message);
 		unuse_commit_buffer(current_head, message);
 		if (!author) {
 			res = error(_("unable to parse commit author"));
@@ -1534,7 +1534,7 @@  static int try_to_commit(struct repository *r,
 	free_commit_extra_headers(extra);
 	strbuf_release(&err);
 	strbuf_release(&commit_msg);
-	free(amend_author);
+	free(author_to_free);
 
 	return res;
 }