int flags; /* REF_NODEREF? */
int have_old; /* 1 if old_sha1 is valid, 0 otherwise */
struct ref_lock *lock;
+ int type;
const char refname[FLEX_ARRAY];
};
{
int ret = 0, delnum = 0, i;
struct ref_update **updates;
- int *types;
const char **delnames;
int n = transaction->nr;
/* Allocate work space */
updates = xmalloc(sizeof(*updates) * n);
- types = xmalloc(sizeof(*types) * n);
delnames = xmalloc(sizeof(*delnames) * n);
/* Copy, sort, and reject duplicate refs */
(update->have_old ?
update->old_sha1 : NULL),
update->flags,
- &types[i], onerr);
+ &update->type, onerr);
if (!update->lock) {
ret = 1;
goto cleanup;
if (update->lock) {
delnames[delnum++] = update->lock->ref_name;
- ret |= delete_ref_loose(update->lock, types[i]);
+ ret |= delete_ref_loose(update->lock, update->type);
}
}
if (updates[i]->lock)
unlock_ref(updates[i]->lock);
free(updates);
- free(types);
free(delnames);
ref_transaction_free(transaction);
return ret;