[PATCH RFC 1/9] string: allow override for strstarts()

Heiko Stuebner heiko at sntech.de
Fri Nov 4 15:51:45 PDT 2022


In some special cases it may be necessary to also override the
inline strstarts() function, so move the relevant #ifdef in place.

Signed-off-by: Heiko Stuebner <heiko at sntech.de>
---
 include/linux/string.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/string.h b/include/linux/string.h
index cf7607b32102..2e5483238532 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -206,6 +206,7 @@ extern ssize_t memory_read_from_buffer(void *to, size_t count, loff_t *ppos,
 
 int ptr_to_hashval(const void *ptr, unsigned long *hashval_out);
 
+#ifndef __HAVE_ARCH_STRSTARTS
 /**
  * strstarts - does @str start with @prefix?
  * @str: string to examine
@@ -215,6 +216,7 @@ static inline bool strstarts(const char *str, const char *prefix)
 {
 	return strncmp(str, prefix, strlen(prefix)) == 0;
 }
+#endif
 
 size_t memweight(const void *ptr, size_t bytes);
 
-- 
2.35.1




More information about the linux-riscv mailing list