This solves warnings due to -Wbuiltin-declaration-mismatch

Signed-off-by: Andrea Bastoni <[email protected]>
---
 hypervisor/include/jailhouse/string.h | 5 +++--
 hypervisor/include/jailhouse/types.h  | 6 ++++++
 hypervisor/lib.c                      | 5 ++---
 3 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/hypervisor/include/jailhouse/string.h 
b/hypervisor/include/jailhouse/string.h
index 24f0b0b4..7dc3de3b 100644
--- a/hypervisor/include/jailhouse/string.h
+++ b/hypervisor/include/jailhouse/string.h
@@ -12,9 +12,10 @@
  * This work is licensed under the terms of the GNU GPL, version 2.  See
  * the COPYING file in the top-level directory.
  */
+#include <jailhouse/types.h>
 
-void *memcpy(void *d, const void *s, unsigned long n);
-void *memset(void *s, int c, unsigned long n);
+void *memcpy(void *d, const void *s, size_t n);
+void *memset(void *s, int c, size_t n);
 
 int strcmp(const char *s1, const char *s2);
 
diff --git a/hypervisor/include/jailhouse/types.h 
b/hypervisor/include/jailhouse/types.h
index 828e40f7..6d78ad6d 100644
--- a/hypervisor/include/jailhouse/types.h
+++ b/hypervisor/include/jailhouse/types.h
@@ -55,6 +55,12 @@ typedef u32 __u32;
 typedef s64 __s64;
 typedef u64 __u64;
 
+#if BITS_PER_LONG == 64
+typedef unsigned long size_t;
+#else
+typedef unsigned int size_t;
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* !_JAILHOUSE_JAILHOUSE_TYPES_H */
diff --git a/hypervisor/lib.c b/hypervisor/lib.c
index fc9af7aa..3fcd41b0 100644
--- a/hypervisor/lib.c
+++ b/hypervisor/lib.c
@@ -11,9 +11,8 @@
  */
 
 #include <jailhouse/string.h>
-#include <jailhouse/types.h>
 
-void *memset(void *s, int c, unsigned long n)
+void *memset(void *s, int c, size_t n)
 {
        u8 *p = s;
 
@@ -33,7 +32,7 @@ int strcmp(const char *s1, const char *s2)
        return *(unsigned char *)s1 - *(unsigned char *)s2;
 }
 
-void *memcpy(void *dest, const void *src, unsigned long n)
+void *memcpy(void *dest, const void *src, size_t n)
 {
        const u8 *s = src;
        u8 *d = dest;
-- 
2.28.0

-- 
You received this message because you are subscribed to the Google Groups 
"Jailhouse" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jailhouse-dev/20201028210933.138379-3-andrea.bastoni%40tum.de.

Reply via email to