git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fetch-pack: Remove unused struct 'loose_object_iter'
@ 2024-05-12  0:59 Dr. David Alan Gilbert
  2024-05-13 10:02 ` Patrick Steinhardt
  2024-05-15  6:46 ` Jeff King
  0 siblings, 2 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2024-05-12  0:59 UTC (permalink / raw)
  To: git; +Cc: jonathantanmy, gitster, Dr. David Alan Gilbert

'loose_object_iter' in fetch-pack.c is unused since
commit 97b2fa08b6b9ee3e ("fetch-pack: drop custom loose object cache")
Remove it.

Signed-off-by: Dr. David Alan Gilbert <dave@treblig.org>
---
 fetch-pack.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/fetch-pack.c b/fetch-pack.c
index 091f9a80a9..28a62e502e 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -732,11 +732,6 @@ static void mark_alternate_complete(struct fetch_negotiator *negotiator UNUSED,
 	mark_complete(&obj->oid);
 }
 
-struct loose_object_iter {
-	struct oidset *loose_object_set;
-	struct ref *refs;
-};
-
 /*
  * Mark recent commits available locally and reachable from a local ref as
  * COMPLETE.
-- 
2.45.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] fetch-pack: Remove unused struct 'loose_object_iter'
  2024-05-12  0:59 [PATCH] fetch-pack: Remove unused struct 'loose_object_iter' Dr. David Alan Gilbert
@ 2024-05-13 10:02 ` Patrick Steinhardt
  2024-05-13 23:56   ` Junio C Hamano
  2024-05-15  6:46 ` Jeff King
  1 sibling, 1 reply; 5+ messages in thread
From: Patrick Steinhardt @ 2024-05-13 10:02 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: git, jonathantanmy, gitster

[-- Attachment #1: Type: text/plain, Size: 457 bytes --]

On Sun, May 12, 2024 at 01:59:13AM +0100, Dr. David Alan Gilbert wrote:

Tiny nit: we don't capitalize the first letter after the colon in the
subject. I don't think this warrants a reroll of this patch though.

> 'loose_object_iter' in fetch-pack.c is unused since
> commit 97b2fa08b6b9ee3e ("fetch-pack: drop custom loose object cache")
> Remove it.

Good catch, and thanks for providing historical context. The patch looks
obviously good to me.

Patrick

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fetch-pack: Remove unused struct 'loose_object_iter'
  2024-05-13 10:02 ` Patrick Steinhardt
@ 2024-05-13 23:56   ` Junio C Hamano
  0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2024-05-13 23:56 UTC (permalink / raw)
  To: Patrick Steinhardt; +Cc: Dr. David Alan Gilbert, git, jonathantanmy

Patrick Steinhardt <ps@pks.im> writes:

> On Sun, May 12, 2024 at 01:59:13AM +0100, Dr. David Alan Gilbert wrote:
>
> Tiny nit: we don't capitalize the first letter after the colon in the
> subject. I don't think this warrants a reroll of this patch though.
>
>> 'loose_object_iter' in fetch-pack.c is unused since
>> commit 97b2fa08b6b9ee3e ("fetch-pack: drop custom loose object cache")
>> Remove it.
>
> Good catch, and thanks for providing historical context. The patch looks
> obviously good to me.

Thanks, both.  Will queue with a slight copy-editing of the proposed
log message.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fetch-pack: Remove unused struct 'loose_object_iter'
  2024-05-12  0:59 [PATCH] fetch-pack: Remove unused struct 'loose_object_iter' Dr. David Alan Gilbert
  2024-05-13 10:02 ` Patrick Steinhardt
@ 2024-05-15  6:46 ` Jeff King
  2024-05-15 10:41   ` Dr. David Alan Gilbert
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff King @ 2024-05-15  6:46 UTC (permalink / raw)
  To: Dr. David Alan Gilbert; +Cc: git, jonathantanmy, gitster

On Sun, May 12, 2024 at 01:59:13AM +0100, Dr. David Alan Gilbert wrote:

> 'loose_object_iter' in fetch-pack.c is unused since
> commit 97b2fa08b6b9ee3e ("fetch-pack: drop custom loose object cache")
> Remove it.

Thanks, this was my fault for leaving it in. The patch looks obviously
good.

I wish there was a good way to get the compiler to report on unused
types, but I don't think there is (it's a complicated problem in
general, but file-local ones like this feel like they should be easy to
spot).

Here's a really hacky (and quadratic) attempt to find defined structs
that aren't mentioned elsewhere:

  for i in $(git grep -ho '^struct [a-z_]* {' | cut -d' ' -f2)
  do
	used=$(git grep -Phc "\b$i\b" |
	       perl -ne '$x += $_; END { print $x }')
	echo "$used $i"
  done |
  sort -n

which finds exactly one unused struct, the one in this patch.

-Peff

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] fetch-pack: Remove unused struct 'loose_object_iter'
  2024-05-15  6:46 ` Jeff King
@ 2024-05-15 10:41   ` Dr. David Alan Gilbert
  0 siblings, 0 replies; 5+ messages in thread
From: Dr. David Alan Gilbert @ 2024-05-15 10:41 UTC (permalink / raw)
  To: Jeff King; +Cc: git, jonathantanmy, gitster

* Jeff King (peff@peff.net) wrote:
> On Sun, May 12, 2024 at 01:59:13AM +0100, Dr. David Alan Gilbert wrote:
> 
> > 'loose_object_iter' in fetch-pack.c is unused since
> > commit 97b2fa08b6b9ee3e ("fetch-pack: drop custom loose object cache")
> > Remove it.
> 
> Thanks, this was my fault for leaving it in. The patch looks obviously
> good.

Thanks.
Most projects I've looked at seem to have one or more.

> I wish there was a good way to get the compiler to report on unused
> types, but I don't think there is (it's a complicated problem in
> general, but file-local ones like this feel like they should be easy to
> spot).

Alas not.

> Here's a really hacky (and quadratic) attempt to find defined structs
> that aren't mentioned elsewhere:
> 
>   for i in $(git grep -ho '^struct [a-z_]* {' | cut -d' ' -f2)
>   do
> 	used=$(git grep -Phc "\b$i\b" |
> 	       perl -ne '$x += $_; END { print $x }')
> 	echo "$used $i"
>   done |
>   sort -n
> 
> which finds exactly one unused struct, the one in this patch.

My similarly hacky script was:
  
  grep -r '^struct [^(=]* {'| tr ':' ' ' |
  while read FNAME STRUCT NAME TAIL
  do
    echo "$FNAME" | grep -q '[.]c$' || continue
  echo ">>>" $FNAME ' : ' $NAME
  echo -n "Count: "
  grep $NAME $FNAME | wc -l 
  #grep $VARNAME $FNAME
  done

(A count of 1 being the unused ones).

Dave


> 
> -Peff
-- 
 -----Open up your eyes, open up your mind, open up your code -------   
/ Dr. David Alan Gilbert    |       Running GNU/Linux       | Happy  \ 
\        dave @ treblig.org |                               | In Hex /
 \ _________________________|_____ http://www.treblig.org   |_______/

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-05-15 10:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-12  0:59 [PATCH] fetch-pack: Remove unused struct 'loose_object_iter' Dr. David Alan Gilbert
2024-05-13 10:02 ` Patrick Steinhardt
2024-05-13 23:56   ` Junio C Hamano
2024-05-15  6:46 ` Jeff King
2024-05-15 10:41   ` Dr. David Alan Gilbert

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).