From e0d9e08b1563b6b5d66cf24b6c9a1488218d1220 Mon Sep 17 00:00:00 2001 From: Joshua Haberman Date: Wed, 8 Jul 2009 13:51:29 -0700 Subject: Re-enable sorting when the descriptor type is not compiled in. --- src/upb_msg.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'src/upb_msg.h') diff --git a/src/upb_msg.h b/src/upb_msg.h index 8910505..ef49776 100644 --- a/src/upb_msg.h +++ b/src/upb_msg.h @@ -159,11 +159,19 @@ INLINE struct google_protobuf_FieldDescriptorProto *upb_msg_field_descriptor( return m->field_descriptors[f->field_index]; } -/* Initializes/frees a upb_msg. Caller retains ownership of d, but the msg - * will contain references to it, so it must outlive the msg. Note that init - * does not resolve upb_msg_field.ref -- the caller should do that - * post-initialization by calling upb_msg_ref() below. */ -bool upb_msg_init(struct upb_msg *m, struct google_protobuf_DescriptorProto *d); +/* Initializes/frees a upb_msg. Usually this will be called by upb_context, and + * clients will not have to construct one directly. + * + * Caller retains ownership of d, but the msg will contain references to it, so + * it must outlive the msg. Note that init does not resolve upb_msg_field.ref + * the caller should do that post-initialization by calling upb_msg_ref() + * below. + * + * sort indicates whether or not it is safe to reorder the fields from the order + * they appear in d. This should be false if code has been compiled against a + * header for this type that expects the given order. */ +bool upb_msg_init(struct upb_msg *m, struct google_protobuf_DescriptorProto *d, + bool sort); void upb_msg_free(struct upb_msg *m); /* Clients use this function on a previously initialized upb_msg to resolve the -- cgit v1.2.3