mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-27 13:46:01 +01:00
Remove use of FOREACH macros
This commit is contained in:
parent
61d6ff288f
commit
3841da009d
1 changed files with 14 additions and 20 deletions
|
@ -974,19 +974,14 @@ typedef struct {
|
|||
int freq;
|
||||
} sample_t;
|
||||
|
||||
static int
|
||||
document_page_size_comp(const void *a, const void *b)
|
||||
{
|
||||
static int document_page_size_comp(const void* a, const void* b) {
|
||||
const sample_t* lhs = a;
|
||||
const sample_t* rhs = b;
|
||||
return rhs->freq - lhs->freq;
|
||||
}
|
||||
|
||||
static void
|
||||
document_open_page_most_frequent_size(zathura_document_t *document,
|
||||
unsigned int *width,
|
||||
unsigned int *height)
|
||||
{
|
||||
static void document_open_page_most_frequent_size(zathura_document_t* document, unsigned int* width,
|
||||
unsigned int* height) {
|
||||
girara_list_t* samples = girara_list_new2(g_free);
|
||||
const unsigned int number_of_pages = zathura_document_get_number_of_pages(document);
|
||||
|
||||
|
@ -996,13 +991,12 @@ document_open_page_most_frequent_size(zathura_document_t *document,
|
|||
const double h = zathura_page_get_height(page);
|
||||
|
||||
bool found = false;
|
||||
GIRARA_LIST_FOREACH_BODY(samples, sample_t*, sample,
|
||||
for (size_t idx = 0; idx != girara_list_size(samples) && !found; ++idx) {
|
||||
sample_t* sample = girara_list_nth(samples, idx);
|
||||
if (fabs(sample->h - h) <= DBL_EPSILON && fabs(sample->w - w) <= DBL_EPSILON) {
|
||||
sample->freq++;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
if (found == false) {
|
||||
sample_t* sample = g_try_malloc0(sizeof(sample_t));
|
||||
|
|
Loading…
Reference in a new issue