]> xenbits.xensource.com Git - xen.git/commitdiff
string: drop redundant declarations
authorJan Beulich <jbeulich@suse.com>
Fri, 16 Apr 2021 12:44:01 +0000 (14:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 16 Apr 2021 12:44:01 +0000 (14:44 +0200)
These standard functions shouldn't need custom declarations. The only
case where redundancy might be needed is if there were inline functions
there. But we don't have any here (anymore). Prune the per-arch headers
of duplicate declarations while moving the asm/string.h inclusion past
the declarations.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Julien Grall <jgrall@amazon.com>
xen/include/asm-arm/string.h
xen/include/asm-x86/string.h
xen/include/xen/string.h

index 1804c3c0bcfa039ed0c858b9909c7f899f8d3f1b..b485e4904419be8e014992af345a5a275bd9d573 100644 (file)
@@ -8,41 +8,21 @@
  */
 
 #define __HAVE_ARCH_STRRCHR
-char *strrchr(const char *s, int c);
-
 #define __HAVE_ARCH_STRCHR
-char *strchr(const char *s, int c);
-
 #if defined(CONFIG_ARM_64)
 #define __HAVE_ARCH_STRCMP
-int strcmp(const char *, const char *);
-
 #define __HAVE_ARCH_STRNCMP
-int strncmp(const char *, const char *, size_t);
-
 #define __HAVE_ARCH_STRLEN
-size_t strlen(const char *);
-
 #define __HAVE_ARCH_STRNLEN
-size_t strnlen(const char *, size_t);
 #endif
 
 #define __HAVE_ARCH_MEMCPY
-void *memcpy(void *, const void *, size_t);
-
 #if defined(CONFIG_ARM_64)
 #define __HAVE_ARCH_MEMCMP
-int memcmp(const void *, const void *, size_t);
 #endif
-
 #define __HAVE_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t n);
-
 #define __HAVE_ARCH_MEMSET
-void *memset(void *, int, size_t);
-
 #define __HAVE_ARCH_MEMCHR
-void *memchr(const void *, int, size_t);
 
 #if defined(CONFIG_ARM_32)
 
index 6f3c960f057dda0718cf9e23a755ab7e8a1d3cea..4f1e1d4daf836eb90c21a9e3e5d293834ebff389 100644 (file)
@@ -2,15 +2,12 @@
 #define __X86_STRING_H__
 
 #define __HAVE_ARCH_MEMCPY
-void *memcpy(void *dest, const void *src, size_t n);
 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 
 #define __HAVE_ARCH_MEMMOVE
-void *memmove(void *dest, const void *src, size_t n);
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 
 #define __HAVE_ARCH_MEMSET
-void *memset(void *dest, int c, size_t n);
 #define memset(s, c, n) __builtin_memset(s, c, n)
 
 #endif /* __X86_STRING_H__ */
index 4b3b57e74fbd125c9918e6ac1bd792be0fd88874..4f438b018aea51c5d814884c6c268767adac77a1 100644 (file)
@@ -3,11 +3,6 @@
 
 #include <xen/types.h> /* for size_t */
 
-/*
- * Include machine specific inline routines
- */
-#include <asm/string.h>
-
 /*
  * These string functions are considered too dangerous for normal use.
  * Use safe_strcpy(), safe_strcat(), strlcpy(), strlcat() as appropriate.
 #define strncpy __xen_has_no_strncpy__
 #define strncat __xen_has_no_strncat__
 
-#ifndef __HAVE_ARCH_STRLCPY
 size_t strlcpy(char *, const char *, size_t);
-#endif
-
-#ifndef __HAVE_ARCH_STRLCAT
 size_t strlcat(char *, const char *, size_t);
-#endif
+int strcmp(const char *, const char *);
+int strncmp(const char *, const char *, size_t);
+int strnicmp(const char *, const char *, size_t);
+int strcasecmp(const char *, const char *);
+char *strchr(const char *, int);
+char *strrchr(const char *, int);
+char *strstr(const char *, const char *);
+size_t strlen(const char *);
+size_t strnlen(const char *, size_t);
+char *strpbrk(const char *, const char *);
+char *strsep(char **, const char *);
+size_t strspn(const char *, const char *);
+
+void *memset(void *, int, size_t);
+void *memcpy(void *, const void *, size_t);
+void *memmove(void *, const void *, size_t);
+int memcmp(const void *, const void *, size_t);
+void *memchr(const void *, int, size_t);
+void *memchr_inv(const void *, int, size_t);
+
+#include <asm/string.h>
 
 #ifndef __HAVE_ARCH_STRCMP
-int strcmp(const char *, const char *);
 #define strcmp(s1, s2) __builtin_strcmp(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRNCMP
-int strncmp(const char *, const char *, size_t);
 #define strncmp(s1, s2, n) __builtin_strncmp(s1, s2, n)
 #endif
 
-#ifndef __HAVE_ARCH_STRNICMP
-int strnicmp(const char *, const char *, size_t);
-#endif
-
 #ifndef __HAVE_ARCH_STRCASECMP
-int strcasecmp(const char *, const char *);
 #define strcasecmp(s1, s2) __builtin_strcasecmp(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRCHR
-char *strchr(const char *, int);
 #define strchr(s1, c) __builtin_strchr(s1, c)
 #endif
 
 #ifndef __HAVE_ARCH_STRRCHR
-char *strrchr(const char *, int);
 #define strrchr(s1, c) __builtin_strrchr(s1, c)
 #endif
 
 #ifndef __HAVE_ARCH_STRSTR
-char *strstr(const char *, const char *);
 #define strstr(s1, s2) __builtin_strstr(s1, s2)
 #endif
 
 #ifndef __HAVE_ARCH_STRLEN
-size_t strlen(const char *);
 #define strlen(s1) __builtin_strlen(s1)
 #endif
 
-#ifndef __HAVE_ARCH_STRNLEN
-size_t strnlen(const char *, size_t);
-#endif
-
-#ifndef __HAVE_ARCH_STRPBRK
-char *strpbrk(const char *, const char *);
-#endif
-
-#ifndef __HAVE_ARCH_STRSEP
-char *strsep(char **, const char *);
-#endif
-
-#ifndef __HAVE_ARCH_STRSPN
-size_t strspn(const char *, const char *);
-#endif
-
-
 #ifndef __HAVE_ARCH_MEMSET
-void *memset(void *, int, size_t);
 #define memset(s, c, n) __builtin_memset(s, c, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCPY
-void *memcpy(void *, const void *, size_t);
 #define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMMOVE
-void *memmove(void *, const void *, size_t);
 #define memmove(d, s, n) __builtin_memmove(d, s, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCMP
-int memcmp(const void *, const void *, size_t);
 #define memcmp(s1, s2, n) __builtin_memcmp(s1, s2, n)
 #endif
 
 #ifndef __HAVE_ARCH_MEMCHR
-void *memchr(const void *, int, size_t);
 #define memchr(s, c, n) __builtin_memchr(s, c, n)
 #endif
 
-void *memchr_inv(const void *, int, size_t);
-
 #define is_char_array(x) __builtin_types_compatible_p(typeof(x), char[])
 
 /* safe_xxx always NUL-terminates and returns !=0 if result is truncated. */