Commit 7d989da3 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0ff122c6
......@@ -225,7 +225,7 @@ int M(VMA *vma, pgoff_t idx) { return bitmap_test_bit(vma->page_ismappedv, idx)
/* _pagev_str returns string representation for vector of pages.
* the memory has to be freed by user. */
* returned memory has to be freed by user. */
char *_pagev_str(Page **pagev, int pagec) {
char *vstr; size_t _;
FILE *w = open_memstream(&vstr, &_);
......@@ -257,7 +257,7 @@ void _assert_pagev(const char *subj, Page **vok, int nok, Page **pagev, int n,
free(vstr);
}
/* _check_mru checks that ram has MRU pages as specified by pagev. */
/* _check_mru checks that ram has MRU pages as specified by mruok. */
void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char *file, int line) {
Page **mruv = NULL;
int n = 0;
......@@ -265,8 +265,9 @@ void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char *
// collect mruv
list_for_each_backwardly(h, &ram->lru_list) {
n++;
mruv = realloc(mruv, n*sizeof(*mruv));
mruv[n++] = list_entry(h, Page, lru);
mruv[n-1] = list_entry(h, Page, lru);
}
_assert_pagev("check_mru", mruok, nok, mruv, n, func, file, line);
......@@ -281,7 +282,7 @@ void _check_mru(RAM *ram, Page *mruok[], int nok, const char *func, const char *
/* _check_dirty checks that fileh has dirty pages as specified.
* the order of dirty list traversal is to go through most recently dirtied pages first */
* the order of dirty list traversal is to go through most recently dirtied pages first. */
void _check_dirty(BigFileH *fileh, Page *dirtyok[], int nok, const char *func, const char *file, int line) {
Page **dirtyv = NULL;
int n = 0;
......@@ -289,8 +290,9 @@ void _check_dirty(BigFileH *fileh, Page *dirtyok[], int nok, const char *func, c
// collect dirtyv
list_for_each_backwardly(h, &fileh->dirty_pages) {
n++;
dirtyv = realloc(dirtyv, n*sizeof(*dirtyv));
dirtyv[n++] = list_entry(h, Page, in_dirty);
dirtyv[n-1] = list_entry(h, Page, in_dirty);
}
_assert_pagev("check_dirty", dirtyok, nok, dirtyv, n, func, file, line);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment