About: TeX Live provides a comprehensive TeX system including all the major TeX-related programs, macro packages, and fonts that are free software. Windows sources.
  Fossies Dox: w32tex-src.tar.xz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

pool.c File Reference
#include <string.h>
#include <mruby.h>
Include dependency graph for pool.c:

Go to the source code of this file.


struct  mrb_pool_page
struct  mrb_pool


#define POOL_ALIGNMENT   8
#define POOL_PAGE_SIZE   16000
#define ALIGN_PADDING(x)   ((SIZE_MAX - (x) + 1) & (POOL_ALIGNMENT - 1))


mrb_poolmrb_pool_open (mrb_state *mrb)
void mrb_pool_close (mrb_pool *pool)
static struct mrb_pool_pagepage_alloc (mrb_pool *pool, size_t len)
voidmrb_pool_alloc (mrb_pool *pool, size_t len)
mrb_bool mrb_pool_can_realloc (mrb_pool *pool, void *p, size_t len)
voidmrb_pool_realloc (mrb_pool *pool, void *p, size_t oldlen, size_t newlen)

Macro Definition Documentation


#define ALIGN_PADDING (   x)    ((SIZE_MAX - (x) + 1) & (POOL_ALIGNMENT - 1))

Definition at line 58 of file pool.c.


#define POOL_ALIGNMENT   8

Definition at line 15 of file pool.c.


#define POOL_PAGE_SIZE   16000

Definition at line 22 of file pool.c.

Function Documentation

◆ mrb_pool_alloc()

void* mrb_pool_alloc ( mrb_pool pool,
size_t  len 

Definition at line 108 of file pool.c.

References ALIGN_PADDING, len, n, NULL, page::page, page, and page_alloc().

Referenced by codegen_palloc(), mrb_parser_new(), mrb_pool_realloc(), parser_palloc(), and scope_new().

◆ mrb_pool_can_realloc()

mrb_bool mrb_pool_can_realloc ( mrb_pool pool,
void p,
size_t  len 

Definition at line 136 of file pool.c.

References ALIGN_PADDING, FALSE, if, page::len, len, p, page::page, page, and TRUE.

◆ mrb_pool_close()

void mrb_pool_close ( mrb_pool pool)

Definition at line 77 of file pool.c.

References mrb_free(), and page.

Referenced by codegen_error(), generate_code(), mrb_parser_free(), and scope_finish().

◆ mrb_pool_open()

mrb_pool* mrb_pool_open ( mrb_state mrb)

Definition at line 64 of file pool.c.

References mrb_malloc_simple(), NULL, and pool.

Referenced by mrb_parser_new(), and scope_new().

◆ mrb_pool_realloc()

void* mrb_pool_realloc ( mrb_pool pool,
void p,
size_t  oldlen,
size_t  newlen 

Definition at line 157 of file pool.c.

References ALIGN_PADDING, if, page::len, memcpy, mrb_pool_alloc(), np, NULL, p, page::page, and page.

Referenced by composite_string_node().

◆ page_alloc()

static struct mrb_pool_page* page_alloc ( mrb_pool pool,
size_t  len 

Definition at line 92 of file pool.c.

References page::len, len, mrb_malloc_simple(), page, and POOL_PAGE_SIZE.

Referenced by mrb_pool_alloc().