Skip to contentSkip to conversation

string: Group zero related memory APIs in the header

PATCH New Andy Shevchenko 1 participant 1 message Apr 22 Generic string library

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 string: Group zero related memory APIs in the header

Move mem_is_zero() closer to memzero_explicit() to group semantically close APIs in the header for better browsing experience. No functional changes.

---
 include/linux/string.h | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
include/linux/string.h +12 -12
index b850bd91b3d8..3840be921d79 100644
@@ -284,18 +284,6 @@ static inline void memcpy_flushcache(void *dst, const void *src, size_t cnt)
 void *memchr_inv(const void *s, int c, size_t n);
 char *strreplace(char *str, char old, char new);
 
-/**
- * mem_is_zero - Check if an area of memory is all 0's.
- * @s: The memory area
- * @n: The size of the area
- *
- * Return: True if the area of memory is all 0's.
- */
-static inline bool mem_is_zero(const void *s, size_t n)
-{
-	return !memchr_inv(s, 0, n);
-}
-
 extern void kfree_const(const void *x);
 
 extern char *kstrdup(const char *s, gfp_t gfp) __malloc;
@@ -367,6 +355,18 @@ static inline void memzero_explicit(void *s, size_t count)
 	barrier_data(s);
 }
 
+/**
+ * mem_is_zero - Check if an area of memory is all 0's.
+ * @s: The memory area
+ * @n: The size of the area
+ *
+ * Return: True if the area of memory is all 0's.
+ */
+static inline bool mem_is_zero(const void *s, size_t n)
+{
+	return !memchr_inv(s, 0, n);
+}
+
 /**
  * kbasename - return the last part of a pathname.
  *
Signature · 1 line
2.50.1