1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-26 03:22:00 +03:00

conf-files: improve algorithm O(n²) → O(n)

This commit is contained in:
Lennart Poettering 2018-11-30 16:55:33 +01:00
parent b2ac2b01c8
commit 243dd6ae1d

View File

@ -189,11 +189,12 @@ int conf_files_insert(char ***strv, const char *root, char **dirs, const char *p
* - do nothing if our new entry matches the existing entry,
* - replace the existing entry if our new entry has higher priority.
*/
size_t i;
size_t i, n;
char *t;
int r;
for (i = 0; i < strv_length(*strv); i++) {
n = strv_length(*strv);
for (i = 0; i < n; i++) {
int c;
c = base_cmp((char* const*) *strv + i, (char* const*) &path);