diff options
author | Mattias Andrée <maandree@kth.se> | 2018-10-28 16:40:44 +0100 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2018-10-28 16:40:44 +0100 |
commit | f66c02620d394819a29267b6fe4b682589201cbf (patch) | |
tree | 71f8942398e77ff3a20ec2a463d6a2c9ac88edc2 /mempsetelem.c | |
parent | Add doc to aligned_memdup.h, memdup.h, strdup.h, and strndup.h (diff) | |
download | libsimple-f66c02620d394819a29267b6fe4b682589201cbf.tar.gz libsimple-f66c02620d394819a29267b6fe4b682589201cbf.tar.bz2 libsimple-f66c02620d394819a29267b6fe4b682589201cbf.tar.xz |
m
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'mempsetelem.c')
-rw-r--r-- | mempsetelem.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/mempsetelem.c b/mempsetelem.c index d431604..c8990ed 100644 --- a/mempsetelem.c +++ b/mempsetelem.c @@ -4,7 +4,7 @@ void * -libsimple_mempsetelem(void *buf_, const void *item, size_t size, size_t nitems) +libsimple_mempsetelem(void *buf_, const void *item, size_t size, size_t nitems) /* TODO test */ { switch (size) { case 0: @@ -38,8 +38,10 @@ libsimple_mempsetelem(void *buf_, const void *item, size_t size, size_t nitems) default: { char *buf = buf_; + size_t i; for (; nitems--; buf += size) - memcpy(buf, item, size); + for (i = 0; i < size; i++) + buf[i] = ((const char *)item)[i]; return buf; } } |