Skip to content

Commit

Permalink
Merge branch 'gencode' into gencode2
Browse files Browse the repository at this point in the history
  • Loading branch information
haberman committed Jul 11, 2017
2 parents af43ea7 + 3e8acc3 commit 717a030
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions upb/msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -699,12 +699,15 @@ size_t upb_msg_sizeof(const upb_msglayout *l) {

upb_msg *upb_msg_init(void *mem, const upb_msglayout *l, upb_alloc *a) {
upb_msg *msg = VOIDPTR_AT(mem, upb_msg_internalsize(l));

/* Initialize normal members. */
if (l->data.default_msg) {
memcpy(msg, l->data.default_msg, l->data.size);
} else {
memset(msg, 0, l->data.size);
}

/* Initialize internal members. */
upb_msg_getinternal(msg)->alloc = a;

if (l->data.extendable) {
Expand Down

0 comments on commit 717a030

Please sign in to comment.