aboutsummaryrefslogtreecommitdiffstats
path: root/docs/reference.rst
diff options
context:
space:
mode:
authorPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-08-26 09:56:11 +0300
committerPetteri Aimonen <jpa@git.mail.kapsi.fi>2012-08-26 09:56:11 +0300
commitf1d7640fe1be0f150f604c72108ea516222c2505 (patch)
treed6b08f5623bf6bee597284ddcc8181421ef20d32 /docs/reference.rst
parent440da6959f36022185fc465590b53bd10acda862 (diff)
Add pb_decode_noinit and use it from pb_dec_submessage.
This avoids double initialization when decoding nested submessages. Update issue 28 Status: FixedInGit
Diffstat (limited to 'docs/reference.rst')
-rw-r--r--docs/reference.rst10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/reference.rst b/docs/reference.rst
index ec9aec5d..371c155a 100644
--- a/docs/reference.rst
+++ b/docs/reference.rst
@@ -322,6 +322,16 @@ In addition to EOF, the pb_decode implementation supports terminating a message
For optional fields, this function applies the default value and sets *has_<field>* to false if the field is not present.
+pb_decode_noinit
+----------------
+Same as `pb_decode`_, except does not apply the default values to fields. ::
+
+ bool pb_decode_noinit(pb_istream_t *stream, const pb_field_t fields[], void *dest_struct);
+
+(parameters are the same as for `pb_decode`_.)
+
+The destination structure should be filled with zeros before calling this function. Doing a *memset* manually can be slightly faster than using `pb_decode`_ if you don't need any default values.
+
pb_skip_varint
--------------
Skip a varint_ encoded integer without decoding it. ::