summaryrefslogtreecommitdiff
path: root/src/upb_msg.c
diff options
context:
space:
mode:
authorJoshua Haberman <joshua@reverberate.org>2009-07-08 13:51:29 -0700
committerJoshua Haberman <joshua@reverberate.org>2009-07-08 13:51:29 -0700
commite0d9e08b1563b6b5d66cf24b6c9a1488218d1220 (patch)
tree07ae62f6e0d33bae299f5eb6470a18d2ea334d7d /src/upb_msg.c
parentf8e55823e0cac4afae664ff18e727df30400b068 (diff)
Re-enable sorting when the descriptor type is not compiled in.
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