Am 19.09.19 um 23:47 schrieb SZEDER Gábor:
> Signed-off-by: SZEDER Gábor <[email protected]>
> ---
> builtin/name-rev.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/name-rev.c b/builtin/name-rev.c
> index e406ff8e17..dec2228cc7 100644
> --- a/builtin/name-rev.c
> +++ b/builtin/name-rev.c
> @@ -98,7 +98,7 @@ static void name_rev(struct commit *commit,
> }
>
> if (name == NULL) {
> - name = xmalloc(sizeof(rev_name));
> + name = xmalloc(sizeof(*name));
Here are the declarations of both (and my beloved --function-context
option would only have shown the second one):
typedef struct rev_name {
const char *tip_name;
timestamp_t taggerdate;
int generation;
int distance;
int from_tag;
} rev_name;
struct rev_name *name = get_commit_rev_name(commit);
So your patch is correct. Had me scratching my head when I first saw
it, though. That old code has been present since bd321bcc51 ("Add
git-name-rev", 2005-10-26).
> set_commit_rev_name(commit, name);
> goto copy_data;
> } else if (is_better_name(name, taggerdate, distance, from_tag)) {
>