diff mbox series

parallel-checkout: drop unused checkout state parameter

Message ID 20201005061732.GA2288306@coredump.intra.peff.net (mailing list archive)
State Accepted
Commit 727f754d9b444d8371cb6b9594859ec4cbec5dd6
Headers show
Series parallel-checkout: drop unused checkout state parameter | expand

Commit Message

Jeff King Oct. 5, 2020, 6:17 a.m. UTC
On Tue, Sep 22, 2020 at 07:49:24PM -0300, Matheus Tavares wrote:

> +static int write_pc_item_to_fd(struct parallel_checkout_item *pc_item, int fd,
> +			       const char *path, struct checkout *state)

The "state" parameter is unused here. Maybe this on top of
mt/parallel-checkout-part-1?

-- >8 --
Subject: parallel-checkout: drop unused checkout state parameter

The write_pc_item_to_fd() function takes a "struct checkout *state"
parameter, but never uses it. This was true in its introduction in
fa33dd99f0 (unpack-trees: add basic support for parallel checkout,
2020-09-22). Its caller, write_pc_item(), has already pulled the useful
bits from the state struct into the "path" variable. Let's drop the
useless parameter.

Signed-off-by: Jeff King <peff@peff.net>
---
 parallel-checkout.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Matheus Tavares Oct. 5, 2020, 1:13 p.m. UTC | #1
On Mon, Oct 5, 2020 at 3:17 AM Jeff King <peff@peff.net> wrote:
>
> On Tue, Sep 22, 2020 at 07:49:24PM -0300, Matheus Tavares wrote:
>
> > +static int write_pc_item_to_fd(struct parallel_checkout_item *pc_item, int fd,
> > +                            const char *path, struct checkout *state)
>
> The "state" parameter is unused here. Maybe this on top of
> mt/parallel-checkout-part-1?
>
> -- >8 --
> Subject: parallel-checkout: drop unused checkout state parameter
>
> The write_pc_item_to_fd() function takes a "struct checkout *state"
> parameter, but never uses it. This was true in its introduction in
> fa33dd99f0 (unpack-trees: add basic support for parallel checkout,
> 2020-09-22). Its caller, write_pc_item(), has already pulled the useful
> bits from the state struct into the "path" variable. Let's drop the
> useless parameter.
>
> Signed-off-by: Jeff King <peff@peff.net>

Good catch, thanks.

I was going to suggest squashing this into fa33dd99f0, but I noticed
that mt/parallel-checkout-part-1 is already in next. We don't re-roll
series that are already in next, right?
Jeff King Oct. 5, 2020, 1:45 p.m. UTC | #2
On Mon, Oct 05, 2020 at 10:13:21AM -0300, Matheus Tavares Bernardino wrote:

> I was going to suggest squashing this into fa33dd99f0, but I noticed
> that mt/parallel-checkout-part-1 is already in next. We don't re-roll
> series that are already in next, right?

Correct. That's also why I noticed it; I build my day-to-day Git by
integrating next with my personal topics, and one of my topics turns on
-Wunused-parameter. :)

-Peff
diff mbox series

Patch

diff --git a/parallel-checkout.c b/parallel-checkout.c
index 94b44d2a48..d077618719 100644
--- a/parallel-checkout.c
+++ b/parallel-checkout.c
@@ -233,7 +233,7 @@  static int reset_fd(int fd, const char *path)
 }
 
 static int write_pc_item_to_fd(struct parallel_checkout_item *pc_item, int fd,
-			       const char *path, struct checkout *state)
+			       const char *path)
 {
 	int ret;
 	struct stream_filter *filter;
@@ -347,7 +347,7 @@  void write_pc_item(struct parallel_checkout_item *pc_item,
 		goto out;
 	}
 
-	if (write_pc_item_to_fd(pc_item, fd, path.buf, state)) {
+	if (write_pc_item_to_fd(pc_item, fd, path.buf)) {
 		/* Error was already reported. */
 		pc_item->status = PC_ITEM_FAILED;
 		goto out;