[RFC PATCH v1 01/12] arm: Replace strstarts() by str_has_prefix().
laniel_francis at privacyrequired.com
laniel_francis at privacyrequired.com
Fri Dec 4 12:03:07 EST 2020
From: Francis Laniel <laniel_francis at privacyrequired.com>
The two functions indicates if a string begins with a given prefix.
The only difference is that strstarts() returns a bool while str_has_prefix()
returns the length of the prefix if the string begins with it or 0 otherwise.
Signed-off-by: Francis Laniel <laniel_francis at privacyrequired.com>
---
arch/arm/kernel/module.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index e15444b25ca0..a8cbd040bcfc 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -56,16 +56,16 @@ void *module_alloc(unsigned long size)
bool module_init_section(const char *name)
{
- return strstarts(name, ".init") ||
- strstarts(name, ".ARM.extab.init") ||
- strstarts(name, ".ARM.exidx.init");
+ return str_has_prefix(name, ".init") ||
+ str_has_prefix(name, ".ARM.extab.init") ||
+ str_has_prefix(name, ".ARM.exidx.init");
}
bool module_exit_section(const char *name)
{
- return strstarts(name, ".exit") ||
- strstarts(name, ".ARM.extab.exit") ||
- strstarts(name, ".ARM.exidx.exit");
+ return str_has_prefix(name, ".exit") ||
+ str_has_prefix(name, ".ARM.extab.exit") ||
+ str_has_prefix(name, ".ARM.exidx.exit");
}
int
--
2.20.1
More information about the linux-arm-kernel
mailing list