diff options
author | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-08-10 13:01:09 +0300 |
---|---|---|
committer | Petteri Aimonen <jpa@git.mail.kapsi.fi> | 2014-08-10 13:01:09 +0300 |
commit | 7edf250a627b56c43e44de546b73bf113d9dea59 (patch) | |
tree | 79b4c0f96a62d77664f01db144b25aa25217f974 /pb_common.h | |
parent | a641e21b34aed824b6b919f7ab9937eaadf09473 (diff) |
Switch pb_encode to use the common iterator logic in pb_common.c
Update issue 128
Status: FixedInGit
Diffstat (limited to 'pb_common.h')
-rw-r--r-- | pb_common.h | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/pb_common.h b/pb_common.h index e85f000c..01a37682 100644 --- a/pb_common.h +++ b/pb_common.h @@ -16,13 +16,14 @@ typedef struct { const pb_field_t *start; /* Start of the pb_field_t array */ const pb_field_t *pos; /* Current position of the iterator */ unsigned required_field_index; /* Zero-based index that counts only the required fields */ - void *dest_struct; /* Pointer to the destination structure to decode to */ - void *pData; /* Pointer where to store current field value */ - void *pSize; /* Pointer where to store the size of current array field */ + void *dest_struct; /* Pointer to start of the structure */ + void *pData; /* Pointer to current field value */ + void *pSize; /* Pointer to count/has field */ } pb_field_iter_t; -/* Initialize the field iterator structure to beginning. */ -void pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct); +/* Initialize the field iterator structure to beginning. + * Returns false if the message type is empty. */ +bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_field_t *fields, void *dest_struct); /* Advance the iterator to the next field. * Returns false when the iterator wraps back to the first field. */ |