Remove use of list iterator

This commit is contained in:
Sebastian Ramacher 2023-12-04 00:33:46 +01:00
parent b88781114a
commit 43a65ae878

View file

@ -165,19 +165,16 @@ bool cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list) {
} }
/* search for existing mark */ /* search for existing mark */
girara_list_iterator_t* mark_iter = girara_list_iterator(zathura->global.marks); for (size_t inner_idx = girara_list_size(zathura->global.marks); inner_idx; --inner_idx) {
do { zathura_mark_t* mark = girara_list_nth(zathura->global.marks, inner_idx - 1);
zathura_mark_t* mark = (zathura_mark_t*)girara_list_iterator_data(mark_iter);
if (mark == NULL) { if (mark == NULL) {
continue; continue;
} }
if (mark->key == key) { if (mark->key == key) {
girara_list_remove(zathura->global.marks, mark); girara_list_remove(zathura->global.marks, mark);
continue;
} }
} while (girara_list_iterator_next(mark_iter) != NULL); }
girara_list_iterator_free(mark_iter);
} }
} }