summaryrefslogtreecommitdiff
path: root/src/upb_msg.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/upb_msg.c')
-rw-r--r--src/upb_msg.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/upb_msg.c b/src/upb_msg.c
index 47a8662..6c18c48 100644
--- a/src/upb_msg.c
+++ b/src/upb_msg.c
@@ -33,7 +33,8 @@ static int compare_fields(const void *e1, const void *e2) {
}
}
-bool upb_msg_init(struct upb_msg *m, struct google_protobuf_DescriptorProto *d)
+bool upb_msg_init(struct upb_msg *m, struct google_protobuf_DescriptorProto *d,
+ bool sort)
{
/* TODO: more complete validation.
* TODO: re-enable this check when we properly set this flag. */
@@ -57,8 +58,8 @@ bool upb_msg_init(struct upb_msg *m, struct google_protobuf_DescriptorProto *d)
/* We count on the caller to keep this pointer alive. */
m->field_descriptors[i] = d->field->elements[i];
}
- /* TODO: re-enable proper sorting once the compiler is sorted out. */
- //qsort(m->field_descriptors, m->num_fields, sizeof(void*), compare_fields);
+ if(sort)
+ qsort(m->field_descriptors, m->num_fields, sizeof(void*), compare_fields);
size_t max_align = 0;
for(unsigned int i = 0; i < m->num_fields; i++) {
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback