Removed incorrect assert and added comments.

pull/13171/head
Joshua Haberman 8 years ago
parent 2826811367
commit 3e8acc3f4e
  1. 4
      upb/msg.c

@ -701,13 +701,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 *upb_msg_init(void *mem, const upb_msglayout *l, upb_alloc *a) {
upb_msg *msg = VOIDPTR_AT(mem, upb_msg_internalsize(l)); upb_msg *msg = VOIDPTR_AT(mem, upb_msg_internalsize(l));
/* Initialize normal members. */
if (l->data.default_msg) { if (l->data.default_msg) {
memcpy(msg, l->data.default_msg, l->data.size); memcpy(msg, l->data.default_msg, l->data.size);
} else { } else {
memset(msg, 0, l->data.size); memset(msg, 0, l->data.size);
} }
UPB_ASSERT(!upb_msg_getinternal(msg)->alloc); /* Initialize internal members. */
upb_msg_getinternal(msg)->alloc = a; upb_msg_getinternal(msg)->alloc = a;
if (l->data.extendable) { if (l->data.extendable) {

Loading…
Cancel
Save