Commit f845d9e4 authored by Kir Kolyshkin's avatar Kir Kolyshkin Committed by Pavel Emelyanov

builtin_{memcpy,memset}: make compatible with libc

1. memcpy() last argument is size_t
2. memset() returns void *

Make our builtin_*() functions compatible.

https://travis-ci.org/kolyshkin/criu/builds/174634847Signed-off-by: 's avatarKir Kolyshkin <kir@openvz.org>
Reviewed-by: 's avatarDmitry Safonov <dsafonov@virtuozzo.com>
Signed-off-by: 's avatarPavel Emelyanov <xemul@virtuozzo.com>
parent f851da76
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
#include "common/compiler.h" #include "common/compiler.h"
#ifndef HAS_BUILTIN_MEMCPY #ifndef HAS_BUILTIN_MEMCPY
static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n) static always_inline void *builtin_memcpy(void *to, const void *from, size_t n)
{ {
int i; size_t i;
unsigned char *cto = to; unsigned char *cto = to;
const unsigned char *cfrom = from; const unsigned char *cfrom = from;
...@@ -47,13 +47,15 @@ static always_inline int builtin_strncmp(const char *cs, const char *ct, size_t ...@@ -47,13 +47,15 @@ static always_inline int builtin_strncmp(const char *cs, const char *ct, size_t
#endif #endif
#ifndef HAS_BUILTIN_MEMSET #ifndef HAS_BUILTIN_MEMSET
static always_inline void builtin_memset(void *s, const int c, size_t count) static always_inline void *builtin_memset(void *s, const int c, size_t count)
{ {
char *dest = s; char *dest = s;
size_t i = 0; size_t i = 0;
while (i < count) while (i < count)
dest[i++] = (char) c; dest[i++] = (char) c;
return s;
} }
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment