projects
/
platform
/
upstream
/
systemd.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b2ac2b0
)
conf-files: improve algorithm O(n²) → O(n)
author
Lennart Poettering
<lennart@poettering.net>
Fri, 30 Nov 2018 15:55:33 +0000
(16:55 +0100)
committer
Lennart Poettering
<lennart@poettering.net>
Fri, 30 Nov 2018 15:55:33 +0000
(16:55 +0100)
src/basic/conf-files.c
patch
|
blob
|
history
diff --git
a/src/basic/conf-files.c
b/src/basic/conf-files.c
index
7b44ae2
..
6320674
100644
(file)
--- a/
src/basic/conf-files.c
+++ b/
src/basic/conf-files.c
@@
-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);