ds 0.10.0
A C library to safely yet efficiently work with UTF-8–encoded, growable dynamic strings.
alloc.h File Reference

Declaration of the Allocator type, related constants and functions. More...

#include "ds/usize.h"
Include dependency graph for alloc.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  ds_allocator_t
 An implementation of Allocator can allocate, reallocate (grow, shrink), and deallocate arbitrary blocks of data. More...
 

Macros

#define DS_ALLOCATOR_BYTES   ((ds_usize_t)sizeof (ds_allocator_t))
 The size of Allocator in bytes. More...
 

Variables

ds_allocator_t ds_allocator_global
 The global memory allocator. More...
 

Detailed Description

Declaration of the Allocator type, related constants and functions.

Author
Avinash Maddikonda (svass.nosp@m.saka.nosp@m.vi@gm.nosp@m.ail..nosp@m.com)
Since
0.8.0
Date
2023-08-10

Definition in file alloc.h.

Macro Definition Documentation

◆ DS_ALLOCATOR_BYTES

#define DS_ALLOCATOR_BYTES   ((ds_usize_t)sizeof (ds_allocator_t))

The size of Allocator in bytes.

Examples

Basic usage:

assert (DS_ALLOCATOR_BYTES == sizeof (ds_allocator_t));
#define DS_ALLOCATOR_BYTES
The size of Allocator in bytes.
Definition: alloc.h:95
An implementation of Allocator can allocate, reallocate (grow, shrink), and deallocate arbitrary bloc...
Definition: alloc.h:28

Definition at line 95 of file alloc.h.

Variable Documentation

◆ ds_allocator_global

ds_allocator_t ds_allocator_global
extern

The global memory allocator.

By default, uses the C stdlib malloc, realloc, and free functions, but can be defined to use a custom allocator.

Definition at line 12 of file alloc.c.