[PATCH 1/4] debugedit-classify-ar: Break early for found_debug

Mark Wielaard mark@klomp.org
Mon May 18 12:43:14 GMT 2026


No need to check any more sections if we found one debug section.

	* tools/debugedit-classify-ar.c (classify_ar_member): Break
	from while loop after setting find_debug to true.

Signed-off-by: Mark Wielaard <mark@klomp.org>
---
 tools/debugedit-classify-ar.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/debugedit-classify-ar.c b/tools/debugedit-classify-ar.c
index 3984dcd80905..55633c2bd5f0 100644
--- a/tools/debugedit-classify-ar.c
+++ b/tools/debugedit-classify-ar.c
@@ -1,5 +1,5 @@
 /* Quick and dirty ELF archive member debug checker.
-   Copyright (C) 2025 Mark J. Wielaard <mark@klomp.org>
+   Copyright (C) 2025, 2026 Mark J. Wielaard <mark@klomp.org>
    This file is part of debugedit.
 
    This file is free software; you can redistribute it and/or modify
@@ -97,7 +97,10 @@ classify_ar_member (Elf *member, const char *name, const char *file)
       /* Just check the name.  */
       if (strncmp (sname, ".debug_", strlen (".debug_")) == 0
 	  || strncmp (sname, ".zdebug_", strlen (".zdebug_")) == 0)
-	found_debug = true;
+	{
+	  found_debug = true;
+	  break;
+	}
     }
 
   return found_debug ? 1 : 0;
-- 
2.53.0



More information about the Debugedit mailing list