Blender  V3.3
Classes | Macros | Typedefs | Functions
BLI_memiter.h File Reference
#include "BLI_compiler_attrs.h"
#include "BLI_compiler_compat.h"
#include "BLI_sys_types.h"

Go to the source code of this file.

Classes

struct  BLI_memiter_handle
 

Macros

#define BLI_MEMITER_DEFAULT_SIZE   (1 << 19)
 

Typedefs

typedef struct BLI_memiter BLI_memiter
 
typedef struct BLI_memiter_handle BLI_memiter_handle
 

Functions

BLI_memiterBLI_memiter_create (unsigned int chunk_size_min) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL
 
voidBLI_memiter_alloc (BLI_memiter *mi, unsigned int size) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
 
void BLI_memiter_alloc_from (BLI_memiter *mi, uint elem_size, const void *data_from) ATTR_NONNULL(1
 
void voidBLI_memiter_calloc (BLI_memiter *mi, unsigned int size) ATTR_WARN_UNUSED_RESULT ATTR_RETURNS_NONNULL ATTR_NONNULL(1)
 
void BLI_memiter_destroy (BLI_memiter *mi) ATTR_NONNULL(1)
 
void BLI_memiter_clear (BLI_memiter *mi) ATTR_NONNULL(1)
 
unsigned int BLI_memiter_count (const BLI_memiter *mi) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
voidBLI_memiter_elem_first (BLI_memiter *mi)
 
voidBLI_memiter_elem_first_size (BLI_memiter *mi, unsigned int *r_size)
 
void BLI_memiter_iter_init (BLI_memiter *mi, BLI_memiter_handle *iter) ATTR_NONNULL(1
 
void bool BLI_memiter_iter_done (const BLI_memiter_handle *iter) ATTR_NONNULL(1)
 
voidBLI_memiter_iter_step (BLI_memiter_handle *iter) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
 
voidBLI_memiter_iter_step_size (BLI_memiter_handle *iter, uint *r_size) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
 

Macro Definition Documentation

◆ BLI_MEMITER_DEFAULT_SIZE

#define BLI_MEMITER_DEFAULT_SIZE   (1 << 19)

Definition at line 18 of file BLI_memiter.h.

Typedef Documentation

◆ BLI_memiter

typedef struct BLI_memiter BLI_memiter

Definition at line 1 of file BLI_memiter.h.

◆ BLI_memiter_handle

Private structure.

Function Documentation

◆ BLI_memiter_alloc()

void* BLI_memiter_alloc ( BLI_memiter mi,
unsigned int  size 
)

◆ BLI_memiter_alloc_from()

void BLI_memiter_alloc_from ( BLI_memiter mi,
uint  elem_size,
const void data_from 
)

Referenced by memiter_string_test().

◆ BLI_memiter_calloc()

void void* BLI_memiter_calloc ( BLI_memiter mi,
unsigned int  size 
)

Definition at line 191 of file BLI_memiter.c.

References BLI_memiter_alloc(), and data.

◆ BLI_memiter_clear()

void BLI_memiter_clear ( BLI_memiter mi)

Definition at line 224 of file BLI_memiter.c.

References memiter_free_data(), and memiter_init().

◆ BLI_memiter_count()

unsigned int BLI_memiter_count ( const BLI_memiter mi)

Definition at line 230 of file BLI_memiter.c.

References BLI_memiter::count.

◆ BLI_memiter_create()

BLI_memiter* BLI_memiter_create ( unsigned int  chunk_size_min)
Parameters
chunk_size_minShould be a power of two and significantly larger than the average element size used.

While allocations of any size are supported, they won't be efficient (effectively becoming a single-linked list).

Its intended that many elements can be stored per chunk.

Definition at line 114 of file BLI_memiter.c.

References BLI_memiter::chunk_size_in_bytes_min, MEM_mallocN, MEM_SIZE_OVERHEAD, and memiter_init().

Referenced by DRW_text_cache_create(), memiter_empty_test(), memiter_string_test(), memiter_words10k_test(), and TEST().

◆ BLI_memiter_destroy()

void BLI_memiter_destroy ( BLI_memiter mi)

◆ BLI_memiter_elem_first()

void* BLI_memiter_elem_first ( BLI_memiter mi)

Support direct lookup for the first item.

Definition at line 241 of file BLI_memiter.c.

References BLI_memiter_elem::data, BLI_memiter_chunk::data, BLI_memiter::head, and NULL.

◆ BLI_memiter_elem_first_size()

void* BLI_memiter_elem_first_size ( BLI_memiter mi,
unsigned int *  r_size 
)

◆ BLI_memiter_iter_done()

void bool BLI_memiter_iter_done ( const BLI_memiter_handle iter)

Definition at line 281 of file BLI_memiter.c.

References BLI_memiter_handle::elem_left.

◆ BLI_memiter_iter_init()

void BLI_memiter_iter_init ( BLI_memiter mi,
BLI_memiter_handle iter 
)

◆ BLI_memiter_iter_step()

void* BLI_memiter_iter_step ( BLI_memiter_handle iter)

◆ BLI_memiter_iter_step_size()

void* BLI_memiter_iter_step_size ( BLI_memiter_handle iter,
uint r_size 
)