Hi,

[I rarely do reviews on this list, so feel free to ignore this.]

On 17 June 2013 13:10, Mathieu Lienard--Mayor
<mathieu.lienard--ma...@ensimag.imag.fr> wrote:
> diff --git a/wt-status.c b/wt-status.c
> index bf84a86..5f5cddf 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -885,8 +885,19 @@ static void show_rebase_in_progress(struct wt_status *s,
>                                 struct wt_status_state *state,
>                                 const char *color)
>  {
> +       char *stopped_sha = 
> read_line_from_git_path("rebase-merge/stopped-sha");
> +       int must_free_stopped_sha = 1;
>         struct stat st;
>
> +       /*
> +        * If the file stopped-sha does not exist
> +        * we go back to the old output saying "a commit"
> +        * instead of providing the commit's SHA1.
> +        */
> +       if (!stopped_sha) {
> +               stopped_sha = "a commit";
> +               must_free_stopped_sha = 0;
> +       }

Rather than having to assign a toggle of deciding when to free
stopped_sha, how much overhead would be introduced by just doing:

    if (!stopped_sha)
        stopped_sha = strdup("a commit");

And then at the end just do:

free (stopped_sha);

Just a thought.

-- Thomas Adam
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to