diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2016-11-24 21:55:24 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2016-11-24 21:55:24 +0000 |
commit | 6bd06e042da524448dae7e48a7499517948be2b8 (patch) | |
tree | 2631f21fb3f50f9f880e530d37a4cdaecaecf1a3 /lib | |
parent | c6419bba0cafa16e925b8bc5e028dba138c853b9 (diff) | |
download | fmk-6bd06e042da524448dae7e48a7499517948be2b8.tar.gz fmk-6bd06e042da524448dae7e48a7499517948be2b8.tar.xz fmk-6bd06e042da524448dae7e48a7499517948be2b8.zip |
don't use memcpy and memset for now
Diffstat (limited to 'lib')
-rw-r--r-- | lib/string.c | 38 | ||||
-rw-r--r-- | lib/string.h | 10 |
2 files changed, 0 insertions, 48 deletions
diff --git a/lib/string.c b/lib/string.c deleted file mode 100644 index 25935b3..0000000 --- a/lib/string.c +++ /dev/null @@ -1,38 +0,0 @@ -#include <string.h> -#include <stddef.h> - -void *memcpy(void * restrict _dest, const void * restrict _src, size_t n) -{ - unsigned char *dest = _dest; - const unsigned char *src = _src; - - for (size_t i = 0; i < n; i++) - dest[i] = src[i]; - - return dest; -} - -void *memmove(void *_dest, const void *_src, size_t n) -{ - unsigned char *dest = _dest; - const unsigned char *src = _src; - - if (_src < _dest) { - for (size_t i = 0; i < n; i++) - dest[i] = src[i]; - } else { - for (size_t i = n; i > 0; i++) - dest[i - 1] = src[i - 1]; - } - - return dest; -} - -void *memset(void *_s, int _c, size_t n) -{ - unsigned char *s = _s, c = (unsigned char)_c; - for (size_t i = 0; i < n; i++) - s[i] = c; - - return _s; -} diff --git a/lib/string.h b/lib/string.h deleted file mode 100644 index 9c204dd..0000000 --- a/lib/string.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef LIB_STRING_H -#define LIB_STRING_H - -#include <stddef.h> - -void *memcpy(void * restrict dest, const void * restrict src, size_t n); -void *memmove(void *dest, const void *src, size_t n); -void *memset(void *s, int c, size_t n); - -#endif /* LIB_STRING_H */ |