Skip to contentSkip to conversation

ip: remove redundant human-readable option match

PATCH Applied Mohammad abu saleh 2 participants 2 messages Sep 29 – Oct 2

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ip: remove redundant human-readable option match

matches() checks whether its first argument is a prefix of its second argument. Therefore, matching "-human-readable" already covers "-human" and its abbreviations.

Remove the redundant condition.

---
 ip/ip.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
ip/ip.c +1 -2
index e4b71bde..dd84f94b 100644
@@ -224,8 +224,7 @@ int main(int argc, char **argv)
 			preferred_family = AF_MPLS;
 		} else if (strcmp(opt, "-B") == 0) {
 			preferred_family = AF_BRIDGE;
-		} else if (matches(opt, "-human") == 0 ||
-			   matches(opt, "-human-readable") == 0) {
+		} else if (matches(opt, "-human-readable") == 0) {
 			++human_readable;
 		} else if (matches(opt, "-iec") == 0) {
 			++use_iec;
Signature · 1 line
2.53.0
#1 lore raw
This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 9 lines · On Wed, 30 Sep 2026 01:55:43 +0200 you wrote:

matches() checks whether its first argument is a prefix of its second argument. Therefore, matching "-human-readable" already covers "-human" and its abbreviations.

Remove the redundant condition.

[...]

Here is the summary with links:
- [iproute2-next] ip: remove redundant human-readable option match

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=a954ab5afd8a

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html