Closed GoogleCodeExporter closed 8 years ago
This issue was updated by revision f1d7640fe1be.
Original comment by Petteri.Aimonen
on 26 Aug 2012 at 6:57
Thanks for spotting this. I added pb_decode_noinit and modified
pb_dec_submessage to use that, which should avoid the overhead.
I made pb_decode_noinit public on the grounds that some performance-conscious
people might want to call memset(foo,0,sizeof(foo)) themselves if they need no
default values.
Original comment by Petteri.Aimonen
on 26 Aug 2012 at 6:59
Gah, actually; I'll have to revert the previous one. It's more complex than I
thought.
The submessages need to be initialized when pb_dec_submessage does its thing,
because otherwise submessages inside an array would not receive the proper
default values. Instead, pb_message_set_to_defaults might be able to skip the
recursion, though then a submessage that is never received will be left
uninitialized.
Original comment by Petteri.Aimonen
on 26 Aug 2012 at 7:05
This issue was updated by revision 160f02e4d0f8.
Original comment by Petteri.Aimonen
on 26 Aug 2012 at 8:06
Ok; now it should work properly and it is also backed by new testcases for the
proper default fields initialization.
I think there should be no double-initialization happening now, though I didn't
add testcases to guard for it (it would be just a performance problem anyway,
difficult to test).
Original comment by Petteri.Aimonen
on 26 Aug 2012 at 8:07
Fix released in nanopb-0.1.6.
Original comment by Petteri.Aimonen
on 3 Sep 2012 at 5:46
Original issue reported on code.google.com by
Adam.Cha...@gmail.com
on 25 Aug 2012 at 8:29