Skip to contentSkip to conversation

repo: Remove unnecessary variable shadow

PATCH In review K Jayatheerth 3 participants 4 messages Feb 23 – Feb 27

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 repo: Remove unnecessary variable shadow

Avoid redeclaring entry inside the conditional block, removing unnecessary variable shadowing and improving code clarity without changing behavior.

---
 builtin/repo.c | 1 -
 1 file changed, 1 deletion(-)
builtin/repo.c +0 -1
index 0ea045abc1..5540bd25d2 100644
@@ -412,7 +412,6 @@ static void stats_table_print_structure(const struct stats_table *table)
 		const char *unit = "";
 
 		if (entry) {
-			struct stats_table_entry *entry = item->util;
 			value = entry->value;
 			if (entry->unit)
 				unit = entry->unit;
Signature · 1 line
2.53.0
#1 lore raw
Quoted 14 lines · K Jayatheerth

Avoid redeclaring entry inside the conditional block, removing unnecessary variable shadowing and improving code clarity without changing behavior.

---
 builtin/repo.c | 1 -
 1 file changed, 1 deletion(-)
builtin/repo.c +0 -0
index 0ea045abc1..5540bd25d2 100644

builtin/repo.c static void stats_table_print_structure(const struct stats_table *table) · line 415

Quoted 4 lines
builtin/repo.c +0 -1
@@ -412,7 +412,6 @@ static void stats_table_print_structure(const struct stats_table *table)
 		const char *unit = "";
 
 		if (entry) {
-			struct stats_table_entry *entry = item->util;

Yup, this is indeed redundant. Thanks for cleaning up after me.

-Justin

#3 lore raw
Quoted 2 lines · JAYATHEERTH K

I got a review on this patch,
if no one has an issue I wanted to remind it for the next cycle.

Thanks.

An easier way to ping is to resubmit exactly the same patch, with
reviewed-by: or acked-by: trailer crediting the reviewer. We have 2000+ messages in 4 weeks, so "I got a review on this patch" without a pointer is much less useful to verify what feedback came to the thread from whom. FYI here are from the headers of the message I am responding to.

    References: <[email protected]>
    Message-ID: <CA+rGoLeppg4Xaoqg6+SZ=ET=ze6rXUbmjLm5UvmitmRGm9u6ag@mail.gmail.com>

The reference points at the patch itself, and just like Git commits do not have pointers to their children, the original patch message has no links to reviews on it X-<.

I'll commit this with the following change now.

Thanks.

1: 006c49ee01 ! 1: a66c8c7f91 repo: Remove unnecessary variable shadow
@@ Metadata
Author: K Jayatheerth <[email protected]>

## Commit message ##
- repo: Remove unnecessary variable shadow
+ repo: remove unnecessary variable shadow

Avoid redeclaring entry inside the conditional block, removing unnecessary variable shadowing and improving code clarity without changing behavior.

+ Acked-by: Justin Tobler <[email protected]>

## builtin/repo.c ##