Re: [PATCH v6 4/6] transaction: add TRANSACTION_CREATE_EXISTS error
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 11, 2024, 16:34 UTC
- Message-ID
- <xmqqplo6ha4j.fsf@gitster.g>
- In-Reply-To
- <CAOLa=ZQA6vc246LRxW8n+a5qNDGxsSLUAhT-x-9tdAKDb2LBCQ@mail.gmail.com>
karthik nayak <karthik.188@gmail.com> writes:
Show 16 quoted lines
>> + } else {
>> + int checkret;
>> + checkret = check_old_oid(update, &lock->old_oid, err);
>> + if (checkret) {
>> + ret = checkret;
>> + goto out;
>> + }
>
> Can't we simply do:
>
> ret = check_old_oid(update, &lock->old_oid, err);
> if (ret) {
> goto out
> }
>
> if ret is '0', it shouldn't matter no?That's nice. Yes, as long as "ret" has no useful information when we enter this "else" block, reusing it like you did is just fine.
This is one of these moments I tell myself "oh, why didn't *I* think of that" ;-).
Thanks.