Browse files

Copy structs without memcpy.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Reviewed-by: Nelson Elhage <nelhage@mit.edu>
  • Loading branch information...
1 parent 46d940a commit 66a8cd6f82c4a4dc47992bd57b12563500abb001 @andersk andersk committed Feb 28, 2010
Showing with 3 additions and 3 deletions.
  1. +1 −1 message.c
  2. +1 −1 messagelist.c
  3. +1 −1 variable.c
View
2 message.c
@@ -750,7 +750,7 @@ void owl_message_create_from_znotice(owl_message *m, const ZNotice_t *n)
owl_message_set_direction_in(m);
/* first save the full notice */
- memcpy(&(m->notice), n, sizeof(ZNotice_t));
+ m->notice = *n;
/* a little gross, we'll replace \r's with ' ' for now */
owl_zephyr_hackaway_cr(&(m->notice));
View
2 messagelist.c
@@ -84,7 +84,7 @@ int owl_messagelist_expunge(owl_messagelist *ml)
owl_list_cleanup(&(ml->list), NULL);
/* copy the new list to the old list */
- memcpy(&(ml->list), &newlist, sizeof(owl_list));
+ ml->list = newlist;
return(0);
}
View
2 variable.c
@@ -465,7 +465,7 @@ int owl_variable_dict_setup(owl_vardict *vd) {
if (owl_dict_create(vd)) return(-1);
for (var = variables_to_init; var->name != NULL; var++) {
cur = owl_malloc(sizeof(owl_variable));
- memcpy(cur, var, sizeof(owl_variable));
+ *cur = *var;
switch (cur->type) {
case OWL_VARIABLE_OTHER:
cur->set_fn(cur, cur->pval_default);

0 comments on commit 66a8cd6

Please sign in to comment.