From 806ba1c80d86bd59759cf59efc057662eecbcf65 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Sat, 5 Feb 2011 22:07:10 -0800 Subject: Another round of fixes. test_vs_proto2.googlemessage1 passes again, with no memory leaks! --- core/upb_msg.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/upb_msg.c') diff --git a/core/upb_msg.c b/core/upb_msg.c index 1ad73bc..f628e3c 100644 --- a/core/upb_msg.c +++ b/core/upb_msg.c @@ -168,10 +168,10 @@ static void upb_msg_appendval(upb_msg *msg, upb_fielddef *f, upb_value val) { // We do: // - upb_string_recycle(), upb_string_substr() instead of // - upb_string_unref(), upb_string_getref() - // because we have a convenient place of caching these string objects for - // reuse, where as the upb_src who is sending us these strings may not. - // This saves the upb_src from allocating new upb_strings all the time to - // give us. + // because we can conveniently caching these upb_string objects in the + // upb_msg, whereas the upb_src who is sending us these strings may not + // have a good way of caching them. This saves the upb_src from allocating + // new upb_strings all the time to give us. // // If you were using this to copy one upb_msg to another this would // allocate string objects whereas a upb_string_getref could have avoided @@ -183,6 +183,7 @@ static void upb_msg_appendval(upb_msg *msg, upb_fielddef *f, upb_value val) { } else { upb_value_write(p, val, f->type); } + upb_msg_sethas(msg, f); } upb_msg *upb_msg_appendmsg(upb_msg *msg, upb_fielddef *f, upb_msgdef *msgdef) { -- cgit v1.2.3