Skip to content

Commit

Permalink
Use memcpy to copy classes, not assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
yebblies committed Jul 29, 2013
1 parent f1c47fb commit 7d1ffcc
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/inline.c
Expand Up @@ -765,7 +765,7 @@ Expression *DeclarationExp::doInline(InlineDoState *ids)
VarDeclaration *vto;

vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init);
*vto = *vd;
memcpy(vto, vd, sizeof(VarDeclaration));
vto->parent = ids->parent;
vto->csym = NULL;
vto->isym = NULL;
Expand Down Expand Up @@ -859,7 +859,7 @@ Expression *IndexExp::doInline(InlineDoState *ids)
VarDeclaration *vto;

vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init);
*vto = *vd;
memcpy(vto, vd, sizeof(VarDeclaration));
vto->parent = ids->parent;
vto->csym = NULL;
vto->isym = NULL;
Expand Down Expand Up @@ -896,7 +896,7 @@ Expression *SliceExp::doInline(InlineDoState *ids)
VarDeclaration *vto;

vto = new VarDeclaration(vd->loc, vd->type, vd->ident, vd->init);
*vto = *vd;
memcpy(vto, vd, sizeof(VarDeclaration));
vto->parent = ids->parent;
vto->csym = NULL;
vto->isym = NULL;
Expand Down

0 comments on commit 7d1ffcc

Please sign in to comment.