diff options
Diffstat (limited to '')
| -rw-r--r-- | src/string/memccpy.c | 12 | ||||
| -rw-r--r-- | src/string/memcpy.c | 10 | ||||
| -rw-r--r-- | src/string/memfrob.c | 1 |
3 files changed, 13 insertions, 10 deletions
diff --git a/src/string/memccpy.c b/src/string/memccpy.c index 85378d9..4212419 100644 --- a/src/string/memccpy.c +++ b/src/string/memccpy.c @@ -35,10 +35,10 @@ */ void* memccpy(void* restrict whither, const void* restrict whence, int c, size_t size) { - char_t* stop = memchr(whence, c, size); - void* r = NULL + char* stop = memchr(whence, c, size); + void* r = NULL; if (stop != NULL) - size = (size_t)(stop - whence), r = whither + size; + size = (size_t)(stop - (const char*)whence), r = whither + size; memcpy(whither, whence, size); return r; } @@ -62,10 +62,10 @@ void* memccpy(void* restrict whither, const void* restrict whence, int c, size_t */ void* memcmove(void* whither, const void* whence, int c, size_t size) { - char_t* stop = memchr(whence, c, size); - void* r = NULL + char* stop = memchr(whence, c, size); + void* r = NULL; if (stop != NULL) - size = (size_t)(stop - whence), r = whither + size; + size = (size_t)(stop - (const char*)whence), r = whither + size; memmove(whither, whence, size); return r; } diff --git a/src/string/memcpy.c b/src/string/memcpy.c index 4582544..02479cd 100644 --- a/src/string/memcpy.c +++ b/src/string/memcpy.c @@ -18,6 +18,9 @@ #include <string.h> +# pragma GCC diagnostic ignored "-Wdiscarded-qualifiers" + + /** * Copy a memory segment to another, non-overlapping, segment. @@ -30,10 +33,11 @@ void* memcpy(void* restrict whither, const void* restrict whence, size_t size) { /* TODO improve implementation of memcpy */ - void* r = whither; + char* d = whither; + char* s = whence; while (size--) - *whither++ = *whence++; - return r; + *d++ = *s++; + return whither; } diff --git a/src/string/memfrob.c b/src/string/memfrob.c index e43496a..7ec9abd 100644 --- a/src/string/memfrob.c +++ b/src/string/memfrob.c @@ -16,7 +16,6 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <string.h> -#include <stddef.h> |
