Libevhtp  1.2.13
refcount.h File Reference
#include <pthread.h>
Include dependency graph for refcount.h:

Go to the source code of this file.

Data Structures

struct  refcount_
 

Macros

#define ref_upcast(DAT)   (struct refcount_ *)((char *)(DAT - offsetof(struct refcount_, data)))
 
#define ref_barrier(CODE)
 

Functions

static void ref_init_functions (void *(*mallocf)(size_t), void *(*callocf)(size_t, size_t), void *(*reallocf)(void *, size_t), void(*freef)(void *))
 
static unsigned int ref_inc (void *buf)
 
static unsigned int ref_dec (void *buf)
 
static void * ref_malloc (size_t size)
 
static void ref_free (void *buf)
 

Variables

static void(* REF_free )(void *) = free
 
static void *(* REF_realloc )(void *, size_t) = realloc
 
static void *(* REF_malloc )(size_t) = malloc
 

Macro Definition Documentation

◆ ref_barrier

#define ref_barrier (   CODE)
Value:
pthread_mutex_lock(&refc->mux); \
CODE \
pthread_mutex_unlock(&refc->mux)

Definition at line 18 of file refcount.h.

◆ ref_upcast

#define ref_upcast (   DAT)    (struct refcount_ *)((char *)(DAT - offsetof(struct refcount_, data)))

Definition at line 15 of file refcount.h.

Function Documentation

◆ ref_dec()

static unsigned int ref_dec ( void *  buf)
static

Definition at line 47 of file refcount.h.

◆ ref_free()

static void ref_free ( void *  buf)
static

Definition at line 74 of file refcount.h.

◆ ref_inc()

static unsigned int ref_inc ( void *  buf)
static

Definition at line 36 of file refcount.h.

◆ ref_init_functions()

static void ref_init_functions ( void *(*)(size_t)  mallocf,
void *(*)(size_t, size_t)  callocf,
void *(*)(void *, size_t)  reallocf,
void(*)(void *)  freef 
)
inlinestatic

Definition at line 25 of file refcount.h.

◆ ref_malloc()

static void* ref_malloc ( size_t  size)
inlinestatic

Definition at line 58 of file refcount.h.

Variable Documentation

◆ REF_free

void(* REF_free) (void *) = free
static

Definition at line 5 of file refcount.h.

◆ REF_malloc

void*(* REF_malloc) (size_t) = malloc
static

Definition at line 7 of file refcount.h.

◆ REF_realloc

void*(* REF_realloc) (void *, size_t) = realloc
static

Definition at line 6 of file refcount.h.