@@ -357,9 +357,28 @@ __tunables_init (char **envp)
void
__tunables_print (void)
{
- for (int i = 0; i < array_length (tunable_list); i++)
+ int i, j;
+ int sortmap [array_length (tunable_list)];
+
+ for (i = 0; i < array_length (tunable_list); i++)
+ sortmap [i] = i;
+ /* Quick bubble sort is sufficient. */
+ for (i = 0; i < array_length (tunable_list) - 1; i++)
+ for (j = i+1; j < array_length (tunable_list); j++)
+ {
+ const char *ni = tunable_list[sortmap[i]].name;
+ const char *nj = tunable_list[sortmap[j]].name;
+ if (strcmp (ni, nj) > 0)
+ {
+ int t = sortmap[i];
+ sortmap[i] = sortmap[j];
+ sortmap[j] = t;
+ }
+ }
+
+ for (i = 0; i < array_length (tunable_list); i++)
{
- const tunable_t *cur = &tunable_list[i];
+ const tunable_t *cur = &tunable_list[sortmap[i]];
if (cur->type.type_code == TUNABLE_TYPE_STRING
&& cur->val.strval.str == NULL)
_dl_printf ("%s:\n", cur->name);