refactor(core/layout): 清理 layout_registry_t 时改用 for 循环统一代码风格
This commit is contained in:
@@ -21,14 +21,15 @@ void layout_result_push(layout_result_t *result, layout_item_t item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void layout_registry_cleanup(layout_registry_t *registry) {
|
void layout_registry_cleanup(layout_registry_t *registry) {
|
||||||
while (registry->slot_count > 0) {
|
for (size_t i = 0; i < registry->slot_count; ++i) {
|
||||||
layout_slot_t *r = ®istry->slots[--registry->slot_count];
|
layout_slot_t *r = ®istry->slots[i];
|
||||||
p_delete(&r->name);
|
p_delete(&r->name);
|
||||||
p_delete(&r->symbol);
|
p_delete(&r->symbol);
|
||||||
p_delete(&r->description);
|
p_delete(&r->description);
|
||||||
r->fn = nullptr;
|
r->fn = nullptr;
|
||||||
r->id = ZDWM_LAYOUT_ID_INVALID;
|
r->id = ZDWM_LAYOUT_ID_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
p_delete(®istry->slots);
|
p_delete(®istry->slots);
|
||||||
registry->slot_count = 0;
|
registry->slot_count = 0;
|
||||||
registry->slot_capacity = 0;
|
registry->slot_capacity = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user