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.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/upb_msg.c') 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++) { -- cgit v1.2.3