Added a PAGE_DEFAULT_SIZE so max can be set to 0

This commit is contained in:
2024-04-28 14:33:35 +05:30
parent a2c9a06ca6
commit 3085dfeded
2 changed files with 5 additions and 0 deletions

View File

@@ -16,6 +16,9 @@
page_t *page_create(size_t max, page_t *next)
{
if (max == 0)
max = PAGE_DEFAULT_SIZE;
page_t *page = calloc(1, sizeof(*page) + max);
page->available = max;
page->next = next;

View File

@@ -18,6 +18,8 @@
#include <stdbool.h>
#include <stdlib.h>
#define PAGE_DEFAULT_SIZE 256
typedef struct Page
{
struct Page *next;