return 0;
}
-static void config_sort_entries(Config *config) {
- assert(config);
-
- sort_pointer_array((void**) config->entries, config->entry_count, (compare_pointer_func_t) config_entry_compare);
-}
-
static UINTN config_entry_find(Config *config, const CHAR16 *needle) {
assert(config);
config_load_xbootldr(config, loaded_image->DeviceHandle);
/* sort entries after version number */
- config_sort_entries(config);
+ sort_pointer_array((void **) config->entries, config->entry_count, (compare_pointer_func_t) config_entry_compare);
/* if we find some well-known loaders, add them to the end of the list */
config_entry_add_osx(config);
return;
for (UINTN i = 1; i < n_members; i++) {
- BOOLEAN more = FALSE;
+ UINTN k;
+ void *entry = array[i];
- for (UINTN k = 0; k < n_members - i; k++) {
- void *entry;
+ for (k = i; k > 0; k--) {
+ if (compare(array[k - 1], entry) <= 0)
+ break;
- if (compare(array[k], array[k+1]) <= 0)
- continue;
-
- entry = array[k];
- array[k] = array[k+1];
- array[k+1] = entry;
- more = TRUE;
+ array[k] = array[k - 1];
}
- if (!more)
- break;
+
+ array[k] = entry;
}
}