mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-10 18:03:47 +01:00
Remove use of FOREACH macros
This commit is contained in:
parent
a7f6b74b7d
commit
fa210e8d89
@ -139,9 +139,7 @@ cmd_marks_add(girara_session_t* session, girara_list_t* argument_list)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list)
|
||||
{
|
||||
bool cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list) {
|
||||
g_return_val_if_fail(session != NULL, false);
|
||||
g_return_val_if_fail(session->global.data != NULL, false);
|
||||
zathura_t* zathura = (zathura_t*)session->global.data;
|
||||
@ -154,16 +152,15 @@ cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list)
|
||||
return false;
|
||||
}
|
||||
|
||||
GIRARA_LIST_FOREACH_BODY_WITH_ITER(argument_list, char*, iter, key_string,
|
||||
for (size_t idx = 0; idx != girara_list_size(argument_list); ++idx) {
|
||||
char* key_string = girara_list_nth(argument_list, idx);
|
||||
if (key_string == NULL) {
|
||||
girara_list_iterator_next(iter);
|
||||
continue;
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < strlen(key_string); i++) {
|
||||
char key = key_string[i];
|
||||
if (((key >= 0x41 && key <= 0x5A) || (key >=
|
||||
0x61 && key <= 0x7A)) == false) {
|
||||
if (((key >= 0x41 && key <= 0x5A) || (key >= 0x61 && key <= 0x7A)) == false) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -182,14 +179,12 @@ cmd_marks_delete(girara_session_t* session, girara_list_t* argument_list)
|
||||
} while (girara_list_iterator_next(mark_iter) != NULL);
|
||||
girara_list_iterator_free(mark_iter);
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void
|
||||
mark_add(zathura_t* zathura, int key)
|
||||
{
|
||||
static void mark_add(zathura_t* zathura, int key) {
|
||||
if (zathura == NULL || zathura->document == NULL || zathura->global.marks == NULL) {
|
||||
return;
|
||||
}
|
||||
@ -201,16 +196,16 @@ mark_add(zathura_t* zathura, int key)
|
||||
double zoom = zathura_document_get_zoom(zathura->document);
|
||||
|
||||
/* search for existing mark */
|
||||
GIRARA_LIST_FOREACH_BODY_WITH_ITER(zathura->global.marks, zathura_mark_t*, iter, mark,
|
||||
for (size_t idx = 0; idx != girara_list_size(zathura->global.marks); ++idx) {
|
||||
zathura_mark_t* mark = girara_list_nth(zathura->global.marks, idx);
|
||||
if (mark->key == key) {
|
||||
mark->page = page_id;
|
||||
mark->position_x = position_x;
|
||||
mark->position_y = position_y;
|
||||
mark->zoom = zoom;
|
||||
girara_list_iterator_free(iter);
|
||||
return;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
/* add new mark */
|
||||
zathura_mark_t* mark = g_try_malloc0(sizeof(zathura_mark_t));
|
||||
@ -227,18 +222,16 @@ mark_add(zathura_t* zathura, int key)
|
||||
girara_list_append(zathura->global.marks, mark);
|
||||
}
|
||||
|
||||
static void
|
||||
mark_evaluate(zathura_t* zathura, int key)
|
||||
{
|
||||
static void mark_evaluate(zathura_t* zathura, int key) {
|
||||
if (zathura == NULL || zathura->global.marks == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* search for existing mark */
|
||||
GIRARA_LIST_FOREACH_BODY(zathura->global.marks, zathura_mark_t*, mark,
|
||||
for (size_t idx = 0; idx != girara_list_size(zathura->global.marks); ++idx) {
|
||||
zathura_mark_t* mark = girara_list_nth(zathura->global.marks, idx);
|
||||
if (mark != NULL && mark->key == key) {
|
||||
zathura_document_set_zoom(zathura->document,
|
||||
zathura_correct_zoom_value(zathura->ui.session, mark->zoom));
|
||||
zathura_document_set_zoom(zathura->document, zathura_correct_zoom_value(zathura->ui.session, mark->zoom));
|
||||
render_all(zathura);
|
||||
|
||||
zathura_jumplist_add(zathura);
|
||||
@ -246,9 +239,9 @@ mark_evaluate(zathura_t* zathura, int key)
|
||||
position_set(zathura, mark->position_x, mark->position_y);
|
||||
zathura_jumplist_add(zathura);
|
||||
|
||||
break;
|
||||
return;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user