Skip to content

Commit

Permalink
[dyn-config] Sort modes alphabetically when reading. JB#15436
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Perl committed Mar 11, 2014
1 parent dd4731b commit 9284309
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/usb_moded-dyn-config.c
Expand Up @@ -62,6 +62,14 @@ void free_mode_list(GList *modelist)
}
}

static gint compare_modes(gconstpointer a, gconstpointer b)
{
struct mode_list_elem *aa = (struct mode_list_elem *)a;
struct mode_list_elem *bb = (struct mode_list_elem *)b;

return g_strcmp0(aa->mode_name, bb->mode_name);
}

GList *read_mode_list(int diag)
{
GDir *confdir;
Expand Down Expand Up @@ -93,6 +101,8 @@ GList *read_mode_list(int diag)
}
else
log_debug("Mode confdir open failed or file is incomplete/invalid.\n");

g_list_sort (modelist, compare_modes);
return(modelist);
}

Expand Down

0 comments on commit 9284309

Please sign in to comment.