summaryrefslogtreecommitdiffstats
path: root/src/elfclassify.c
diff options
context:
space:
mode:
authorMartin Liska <[email protected]>2021-04-19 14:33:36 +0200
committerMark Wielaard <[email protected]>2021-05-12 11:56:57 +0200
commitadc201f81902f3015a841869756ed4b9b811fe33 (patch)
tree735ab647b6e749f7bbbd1cd88256f89c2de266a9 /src/elfclassify.c
parent857546d176a36d2b5dc18b81dcafa3fb8ec0123d (diff)
Come up with startswith function.
New function in system.h that returns true if a string has a given prefix, false otherwise. Use it in place of strncmp. Signed-off-by: Martin Liška <[email protected]>
Diffstat (limited to 'src/elfclassify.c')
-rw-r--r--src/elfclassify.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/elfclassify.c b/src/elfclassify.c
index ae626bb1..fe7eeeed 100644
--- a/src/elfclassify.c
+++ b/src/elfclassify.c
@@ -16,6 +16,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
+#include <system.h>
#include <argp.h>
#include <error.h>
@@ -335,11 +336,8 @@ run_classify (void)
stderr);
has_bits_alloc = true;
}
- const char *debug_prefix = ".debug_";
- const char *zdebug_prefix = ".zdebug_";
- if (strncmp (section_name, debug_prefix, strlen (debug_prefix)) == 0
- || strncmp (section_name, zdebug_prefix,
- strlen (zdebug_prefix)) == 0)
+ if (startswith (section_name, ".debug_")
+ || startswith (section_name, ".zdebug_"))
{
if (verbose > 1 && !has_debug_sections)
fputs ("debug: .debug_* section found\n", stderr);