]> mj.ucw.cz Git - libucw.git/blobdiff - lib/pagecache.c
Introduced obuck_get_pos(), converted gatherd limits to use it.
[libucw.git] / lib / pagecache.c
index 5acbca4b437e539a37faf813adc6908cc4eda145..57abfeea3beb50193e798d7118cd713dc9e57ffc 100644 (file)
@@ -39,10 +39,9 @@ struct page_cache {
 struct page_cache *
 pgc_open(uns page_size, uns max_pages)
 {
-  struct page_cache *c = xmalloc(sizeof(struct page_cache));
+  struct page_cache *c = xmalloc_zero(sizeof(struct page_cache));
   uns i;
 
-  bzero(c, sizeof(*c));
   init_list(&c->free_pages);
   init_list(&c->locked_pages);
   init_list(&c->dirty_pages);
@@ -65,8 +64,8 @@ pgc_close(struct page_cache *c)
   ASSERT(EMPTY_LIST(c->locked_pages));
   ASSERT(EMPTY_LIST(c->dirty_pages));
   ASSERT(EMPTY_LIST(c->free_pages));
-  free(c->hash_table);
-  free(c);
+  xfree(c->hash_table);
+  xfree(c);
 }
 
 static void
@@ -251,7 +250,7 @@ pgc_cleanup(struct page_cache *c)
       rem_node(&p->hn);
       c->free_count--;
       c->total_count--;
-      free(p);
+      xfree(p);
     }
   ASSERT(!c->free_count);
 }