projects
/
systemd
/
.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
c1979cd
)
repart: Rework unused partition number algorithm
author
Daan De Meyer
<daan.j.demeyer@gmail.com>
Mon, 21 Nov 2022 09:34:28 +0000
(10:34 +0100)
committer
Daan De Meyer
<daan.j.demeyer@gmail.com>
Mon, 21 Nov 2022 09:34:28 +0000
(10:34 +0100)
src/partition/repart.c
patch
|
blob
|
history
diff --git
a/src/partition/repart.c
b/src/partition/repart.c
index b4ef7b8e34b527c7000e71a46014b83002652819..20db7d7a1a78ffb5a1d587a6b5b135e0e35af752 100644
(file)
--- a/
src/partition/repart.c
+++ b/
src/partition/repart.c
@@
-1056,16
+1056,13
@@
static uint64_t find_first_unused_partno(Context *context) {
assert(context);
- for (bool changed = true; changed;) {
- changed = false;
-
- LIST_FOREACH(partitions, p, context->partitions) {
- if (p->partno != UINT64_MAX && p->partno == partno) {
- partno++;
- changed = true;
- break;
- }
- }
+ for (partno = 0;; partno++) {
+ bool found = false;
+ LIST_FOREACH(partitions, p, context->partitions)
+ if (p->partno != UINT64_MAX && p->partno == partno)
+ found = true;
+ if (!found)
+ break;
}
return partno;