Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
42e4284f
Commit
42e4284f
authored
Jan 07, 2013
by
Jeroen Vreeken
Committed by
Michel Roelofs
Jan 07, 2013
Browse files
Use memcpy instead of assignment
parent
9976a7ae
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/dynarg.h
View file @
42e4284f
...
...
@@ -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(tmp
val)
)
; \
clist[-1] = ptr + sizeof(type); \
} while (0)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment