rcx

miscellaneous C library
git clone git://git.rr3.xyz/rcx
Log | Files | Refs | README | LICENSE

macros.h (765B)


      1 #ifdef LIST_STATIC
      2 #undef LIST_STATIC
      3 #define LIST_STATIC static
      4 #else
      5 #define LIST_STATIC
      6 #endif
      7 
      8 #if (defined(LIST_DECLS) || defined(LIST_DEFS)) && !defined(LIST_METHOD)
      9 #error "rcx/list: LIST_METHOD must be defined"
     10 #endif
     11 
     12 #if defined(LIST_ALLOC) || defined(LIST_ALLOCZ) || defined(LIST_REALLOCZ)
     13 #error "rcx/list: invalid allocator option; use LIST_REALLOC"
     14 #endif
     15 
     16 #ifndef LIST_T
     17 #error "rcx/list: LIST_T must be defined"
     18 #endif
     19 
     20 #ifndef LIST_MIN_CAP
     21 #define LIST_MIN_CAP 8
     22 #endif
     23 
     24 #ifndef LIST_REALLOC
     25 #define LIST_REALLOC r_realloc
     26 #endif
     27 
     28 #ifndef LIST_FREE
     29 #define LIST_FREE free
     30 #endif
     31 
     32 /* LIST_ASSERT is used for bounds checks. */
     33 #ifndef LIST_ASSERT
     34 #include "../../debug.h"
     35 #define LIST_ASSERT ASSERT
     36 #endif
     37 
     38 #define LIST_HDR(l) ((RListHdr_ *)(l) - 1)