From: "Rose via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Rose <83477269+AtariDreams@users.noreply.github.com>,
Seija Kijin <doremylover123@gmail.com>
Subject: [PATCH] bisect: remove check for fp and move the goto label after the fclose
Date: Fri, 16 Dec 2022 00:43:22 +0000 [thread overview]
Message-ID: <pull.1397.git.git.1671151402532.gitgitgadget@gmail.com> (raw)
From: Seija Kijin <doremylover123@gmail.com>
The fp check in these function are only relevant if goto has been taken.
Because of this, we should move the label so that fclose is not called.
This is because the goto is taken when fp is 0 anyway.
Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
bisect: remove check for fp and move the goto label after the fclose
The fp check in these function are only relevant if goto has been taken.
Because of this, we should move the label so that fclose is not called.
This is because the goto is taken when fp is 0 anyway.
Signed-off-by: Seija Kijin doremylover123@gmail.com
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1397%2FAtariDreams%2Ffclose-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1397/AtariDreams/fclose-v1
Pull-Request: https://github.com/git/git/pull/1397
builtin/bisect.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/bisect.c b/builtin/bisect.c
index cc9483e8515..2e5dbc8be3b 100644
--- a/builtin/bisect.c
+++ b/builtin/bisect.c
@@ -316,9 +316,9 @@ static int bisect_write(const char *state, const char *rev,
if (!nolog)
fprintf(fp, "git bisect %s %s\n", state, rev);
+ fclose(fp);
+
finish:
- if (fp)
- fclose(fp);
strbuf_release(&tag);
return res;
}
@@ -484,9 +484,9 @@ static int get_terms(struct bisect_terms *terms)
strbuf_getline_lf(&str, fp);
terms->term_good = strbuf_detach(&str, NULL);
+ fclose(fp);
+
finish:
- if (fp)
- fclose(fp);
strbuf_release(&str);
return res;
}
base-commit: 57e2c6ebbe7108b35ba30184dcbcb6c34c929ad8
--
gitgitgadget
next reply other threads:[~2022-12-16 0:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-16 0:43 Rose via GitGitGadget [this message]
2022-12-16 1:03 ` [PATCH] bisect: remove check for fp and move the goto label after the fclose Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=pull.1397.git.git.1671151402532.gitgitgadget@gmail.com \
--to=gitgitgadget@gmail.com \
--cc=83477269+AtariDreams@users.noreply.github.com \
--cc=doremylover123@gmail.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).