diff options
author | Jeff King <peff@peff.net> | 2025-02-25 01:34:21 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2025-02-25 10:25:49 -0800 |
commit | 1cb2f293f5a594fd5dee8400213bd2f395fbd2bf (patch) | |
tree | cf9d3d05476fca38fe9d324991d9fca1c959dc7d /commit.c | |
parent | 547f719d9b022e87eb8cf3cb7a7632822b996e29 (diff) |
unpack_loose_rest(): rewrite return handling for clarity
We have a pattern like:
if (error1)
...handle error 1...
else if (error2)
...handle error 2...
else
...return buf...
...free buf and return NULL...
This is a little subtle because it is the return in the success block
that lets us skip the common error handling. Rewrite this instead to
free the buffer in each error path, marking it as NULL, and then all
code paths can use the common return.
This should make the logic a bit easier to follow. It does mean
duplicating the buf cleanup for errors, but it's a single line.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'commit.c')
0 files changed, 0 insertions, 0 deletions