summaryrefslogtreecommitdiff
path: root/libdwfl/linux-kernel-modules.c
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2021-04-19 14:33:36 +0200
committerMark Wielaard <mark@klomp.org>2021-05-12 11:56:57 +0200
commitadc201f81902f3015a841869756ed4b9b811fe33 (patch)
tree735ab647b6e749f7bbbd1cd88256f89c2de266a9 /libdwfl/linux-kernel-modules.c
parent857546d176a36d2b5dc18b81dcafa3fb8ec0123d (diff)
downloadelfutils-adc201f81902f3015a841869756ed4b9b811fe33.tar.gz
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 <mliska@suse.cz>
Diffstat (limited to 'libdwfl/linux-kernel-modules.c')
-rw-r--r--libdwfl/linux-kernel-modules.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libdwfl/linux-kernel-modules.c b/libdwfl/linux-kernel-modules.c
index 6edb27f2..c0f8dfa4 100644
--- a/libdwfl/linux-kernel-modules.c
+++ b/libdwfl/linux-kernel-modules.c
@@ -924,7 +924,7 @@ dwfl_linux_kernel_module_section_address
if (!strcmp (secname, ".modinfo")
|| !strcmp (secname, ".data.percpu")
- || !strncmp (secname, ".exit", 5))
+ || startswith (secname, ".exit"))
{
*addr = (Dwarf_Addr) -1l;
return DWARF_CB_OK;
@@ -935,7 +935,7 @@ dwfl_linux_kernel_module_section_address
behavior, and this cruft leaks out into the /sys information.
The file name for ".init*" may actually look like "_init*". */
- const bool is_init = !strncmp (secname, ".init", 5);
+ const bool is_init = startswith (secname, ".init");
if (is_init)
{
if (asprintf (&sysfile, SECADDRDIRFMT "_%s",