x86/string: Clean up x86/string.h
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 12 May 2017 14:07:16 +0000 (15:07 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 31 May 2017 13:05:25 +0000 (14:05 +0100)
 * None of the GCC docs mention memmove() in its list of builtins even today,
   but 4.1 does have the builtin, meaning that all currently supported
   compilers have it.
 * Consistently use Xen style, matching the common code, and introduce symbol
   definitions for function pointer use.

No functional change.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <JBeulich@suse.com>
xen/arch/x86/string.c
xen/include/asm-x86/string.h

index 1387dfb541209d7350181c7c1311e50aa1615eb4..cd85a38e6d7713351fa79ccc24bd2385845fe7f1 100644 (file)
@@ -1,14 +1,13 @@
 /******************************************************************************
  * string.c
- * 
+ *
  * These provide something for compiler-emitted string operations to link
  * against.
  */
 
 #include <xen/lib.h>
 
-#undef memcpy
-void *memcpy(void *dest, const void *src, size_t n)
+void *(memcpy)(void *dest, const void *src, size_t n)
 {
     long d0, d1, d2;
 
@@ -23,8 +22,7 @@ void *memcpy(void *dest, const void *src, size_t n)
     return dest;
 }
 
-#undef memset
-void *memset(void *s, int c, size_t n)
+void *(memset)(void *s, int c, size_t n)
 {
     long d0, d1;
 
@@ -37,8 +35,7 @@ void *memset(void *s, int c, size_t n)
     return s;
 }
 
-#undef memmove
-void *memmove(void *dest, const void *src, size_t n)
+void *(memmove)(void *dest, const void *src, size_t n)
 {
     long d0, d1, d2;
 
index c48d9c36c06001d3607d4384dd2bae7c91661ca9..6f3c960f057dda0718cf9e23a755ab7e8a1d3cea 100644 (file)
@@ -2,13 +2,23 @@
 #define __X86_STRING_H__
 
 #define __HAVE_ARCH_MEMCPY
-#define memcpy(t,f,n) (__builtin_memcpy((t),(f),(n)))
+void *memcpy(void *dest, const void *src, size_t n);
+#define memcpy(d, s, n) __builtin_memcpy(d, s, n)
 
-/* Some versions of gcc don't have this builtin. It's non-critical anyway. */
 #define __HAVE_ARCH_MEMMOVE
-extern void *memmove(void *dest, const void *src, size_t n);
+void *memmove(void *dest, const void *src, size_t n);
+#define memmove(d, s, n) __builtin_memmove(d, s, n)
 
 #define __HAVE_ARCH_MEMSET
-#define memset(s,c,n) (__builtin_memset((s),(c),(n)))
+void *memset(void *dest, int c, size_t n);
+#define memset(s, c, n) __builtin_memset(s, c, n)
 
 #endif /* __X86_STRING_H__ */
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */