зеркало из https://github.com/microsoft/git.git
refs.c: allow passing NULL to ref_transaction_free
Allow ref_transaction_free(NULL) as a no-op. This makes ref_transaction_free easier to use and more similar to plain 'free'. In particular, it lets us rollback unconditionally as part of cleanup code after setting 'transaction = NULL' if a transaction has been committed or rolled back already. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com> Signed-off-by: Ronnie Sahlberg <sahlberg@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Acked-by: Michael Haggerty <mhagger@alum.mit.edu>
This commit is contained in:
Родитель
f1c9350ad7
Коммит
1b07255c95
3
refs.c
3
refs.c
|
@ -3338,6 +3338,9 @@ void ref_transaction_free(struct ref_transaction *transaction)
|
|||
{
|
||||
int i;
|
||||
|
||||
if (!transaction)
|
||||
return;
|
||||
|
||||
for (i = 0; i < transaction->nr; i++)
|
||||
free(transaction->updates[i]);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче