Subastra
Loading...
Searching...
No Matches
Data Structures | Macros | Functions
list.h File Reference
#include <memory.h>
#include <sanitizer/asan_interface.h>
#include <string.h>
#include "defs.h"
Include dependency graph for list.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  list_t
 

Macros

#define LIST_DEFAULT_CAPACITY   6
 
#define list_init_ty(ty, ls, alloc)   list_init(ls, alloc, sizeof(ty))
 
#define list_init_ty_with_capacity(ty, ls, alloc, capacity)    list_init_with_capacity(ls, alloc, sizeof(ty), capacity)
 
#define list_init_copy_ty(ty, ls, alloc, data, count)    list_init_copy(ls, alloc, data, sizeof(ty), count)
 
#define list_push_var(ls, var)
 
#define list_get_ty_ptr(ty, ls, idx)   ((ty *)list_get(ls, idx))
 
#define list_get_ty(ty, ls, idx)   (*list_get_ty_ptr(ty, ls, idx))
 

Functions

static void list_init_with_capacity (list_t *ls, allocator_t alloc, sz entry_size, sz capacity)
 
static void list_init (list_t *ls, allocator_t alloc, sz entry_size)
 
static void list_init_copy (list_t *ls, allocator_t alloc, void *data, sz entry_size, sz count)
 
static void list_init_int (list_t *ls, allocator_t alloc)
 
static void list_grow (list_t *ls)
 
static void list_push (list_t *ls, const void *data)
 
static void list_insert (list_t *ls, sz idx, const void *data)
 
static void list_push_int (list_t *ls, const i32 value)
 
static void * list_get (list_t *ls, sz idx)
 
static void list_clear (list_t *ls)
 
static void list_cleanup (list_t *ls)
 

Macro Definition Documentation

◆ LIST_DEFAULT_CAPACITY

#define LIST_DEFAULT_CAPACITY   6

◆ list_get_ty

#define list_get_ty (   ty,
  ls,
  idx 
)    (*list_get_ty_ptr(ty, ls, idx))

◆ list_get_ty_ptr

#define list_get_ty_ptr (   ty,
  ls,
  idx 
)    ((ty *)list_get(ls, idx))

◆ list_init_copy_ty

#define list_init_copy_ty (   ty,
  ls,
  alloc,
  data,
  count 
)     list_init_copy(ls, alloc, data, sizeof(ty), count)

◆ list_init_ty

#define list_init_ty (   ty,
  ls,
  alloc 
)    list_init(ls, alloc, sizeof(ty))

◆ list_init_ty_with_capacity

#define list_init_ty_with_capacity (   ty,
  ls,
  alloc,
  capacity 
)     list_init_with_capacity(ls, alloc, sizeof(ty), capacity)

◆ list_push_var

#define list_push_var (   ls,
  var 
)
Value:
ASSERT(sizeof(var) == (ls)->_entry, \
"Attempt to push a variable of size %ld into a list that expects " \
"size %ld", \
sizeof(var), (ls)->_entry); \
list_push(ls, &var)
#define ASSERT(expr, msg,...)
Definition defs.h:35

Function Documentation

◆ list_cleanup()

static void list_cleanup ( list_t ls)
static

◆ list_clear()

static void list_clear ( list_t ls)
static

◆ list_get()

static void * list_get ( list_t ls,
sz  idx 
)
static

◆ list_grow()

static void list_grow ( list_t ls)
static

◆ list_init()

static void list_init ( list_t ls,
allocator_t  alloc,
sz  entry_size 
)
static

◆ list_init_copy()

static void list_init_copy ( list_t ls,
allocator_t  alloc,
void *  data,
sz  entry_size,
sz  count 
)
static

◆ list_init_int()

static void list_init_int ( list_t ls,
allocator_t  alloc 
)
static

◆ list_init_with_capacity()

static void list_init_with_capacity ( list_t ls,
allocator_t  alloc,
sz  entry_size,
sz  capacity 
)
static

◆ list_insert()

static void list_insert ( list_t ls,
sz  idx,
const void *  data 
)
static

◆ list_push()

static void list_push ( list_t ls,
const void *  data 
)
static

◆ list_push_int()

static void list_push_int ( list_t ls,
const i32  value 
)
static