summaryrefslogtreecommitdiffstats
path: root/pb.h
diff options
context:
space:
mode:
Diffstat (limited to 'pb.h')
-rw-r--r--pb.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/pb.h b/pb.h
index da38d7b9..bb0a584d 100644
--- a/pb.h
+++ b/pb.h
@@ -364,6 +364,17 @@ struct _pb_extension_t {
{tag, PB_ATYPE_CALLBACK | PB_HTYPE_REPEATED | ltype, \
pb_delta_end(st, m, pm), 0, pb_membersize(st, m), 0, ptr}
+/* Optional extensions don't have the has_ field, as that would be redundant. */
+#define PB_OPTEXT_STATIC(tag, st, m, pm, ltype, ptr) \
+ {tag, PB_ATYPE_STATIC | PB_HTYPE_OPTIONAL | ltype, \
+ 0, \
+ 0, \
+ pb_membersize(st, m), 0, ptr}
+
+#define PB_OPTEXT_CALLBACK(tag, st, m, pm, ltype, ptr) \
+ {tag, PB_ATYPE_CALLBACK | PB_HTYPE_OPTIONAL | ltype, \
+ 0, 0, pb_membersize(st, m), 0, ptr}
+
/* The mapping from protobuf types to LTYPEs is done using these macros. */
#define PB_LTYPE_MAP_BOOL PB_LTYPE_VARINT
#define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES