aboutsummaryrefslogtreecommitdiffstats
path: root/mempsetelem.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2018-10-28 16:40:44 +0100
committerMattias Andrée <maandree@kth.se>2018-10-28 16:40:44 +0100
commitf66c02620d394819a29267b6fe4b682589201cbf (patch)
tree71f8942398e77ff3a20ec2a463d6a2c9ac88edc2 /mempsetelem.c
parentAdd doc to aligned_memdup.h, memdup.h, strdup.h, and strndup.h (diff)
downloadlibsimple-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.c6
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;
}
}