Commit 42e4284f authored by Jeroen Vreeken's avatar Jeroen Vreeken Committed by Michel Roelofs
Browse files

Use memcpy instead of assignment

parent 9976a7ae
......@@ -46,11 +46,13 @@ do {\
u.v = (val); \
\
if (!strcmp(#type, "double")) { \
*(double *)&vadyn->regs[vadyn->fp_offset] = u.d;\
memcpy(&vadyn->regs[vadyn->fp_offset], &u.d, sizeof(u.d)); \
/* *(double *)&vadyn->regs[vadyn->fp_offset] = u.d;*/\
vadyn->fp_offset += sizeof(long double);\
} else { \
*(unsigned long *)&vadyn->regs[vadyn->gp_offset] = \
(unsigned long)u.ul;\
memcpy(&vadyn->regs[vadyn->gp_offset], &u.ul, sizeof(u.ul)); \
/* *(unsigned long *)&vadyn->regs[vadyn->gp_offset] = \
(unsigned long)u.ul;*/\
vadyn->gp_offset += sizeof(unsigned long);\
} \
} while (0)
......@@ -78,13 +80,14 @@ do { \
do { \
char *ptr; \
char **clist = (char **)(list); \
type tmpval = val; \
size_t size; \
\
size = ((size_t)clist[-1] - (size_t)(list)); \
clist = realloc(&clist[-1], size + sizeof(type) + sizeof(char *)) + sizeof(char *); \
(list) = (void *)clist; \
ptr = ((char *)clist + size); \
*(type *)ptr = (val); \
memcpy(ptr, &tmpval, sizeof(tmpval)); \
clist[-1] = ptr + sizeof(type); \
} while (0)
......
Supports Markdown
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