+
+static int compare_parsers(const void *a, const void *b)
+{
+ const struct parser *parser_a = a, *parser_b = b;
+
+ if (parser_a->priority > parser_b->priority)
+ return -1;
+
+ if (parser_a->priority < parser_b->priority)
+ return 1;
+
+ return 0;
+}
+
+void parser_init(void)
+{
+ /* sort our parsers into descending priority order */
+ qsort(__start_parsers, __stop_parsers - __start_parsers,
+ sizeof(struct parser), compare_parsers);
+}