From: Lennart Poettering Date: Wed, 6 Feb 2019 16:53:43 +0000 (+0100) Subject: bootspec: only sort entries list once X-Git-Tag: v242~263^2~16 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dd2bf34cd0a39ad7869177f4379de55ad3603e53;p=platform%2Fupstream%2Fsystemd.git bootspec: only sort entries list once Instead of re-sorting entries list each time we loaded enrties from a specific source, let's just sort them once at the end. --- diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index ee285b9..2db6425 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -238,7 +238,6 @@ static int boot_entries_find( _cleanup_strv_free_ char **files = NULL; size_t n_allocated = *n_entries; - bool added = false; char **f; int r; @@ -260,12 +259,8 @@ static int boot_entries_find( continue; (*n_entries) ++; - added = true; } - if (added) - typesafe_qsort(*entries, *n_entries, boot_entry_compare); - return 0; } @@ -444,7 +439,6 @@ static int boot_entries_find_unified( _cleanup_(closedirp) DIR *d = NULL; size_t n_allocated = *n_entries; - bool added = false; struct dirent *de; int r; @@ -499,12 +493,8 @@ static int boot_entries_find_unified( continue; (*n_entries) ++; - added = true; } - if (added) - typesafe_qsort(*entries, *n_entries, boot_entry_compare); - return 0; } @@ -654,6 +644,8 @@ int boot_entries_load_config( return r; } + typesafe_qsort(config->entries, config->n_entries, boot_entry_compare); + r = boot_entries_uniquify(config->entries, config->n_entries); if (r < 0) return log_error_errno(r, "Failed to uniquify boot entries: %m");