src/cx/allocator.h

changeset 396
3539dd99ab92
parent 394
80c31ebd66c1
child 397
cfc1193b1e65
     1.1 --- a/src/cx/allocator.h	Sun Feb 07 16:52:21 2021 +0100
     1.2 +++ b/src/cx/allocator.h	Sun Feb 07 17:17:46 2021 +0100
     1.3 @@ -44,18 +44,20 @@
     1.4  void* cx_calloc_stdlib(cx_allocator a, size_t nelem, size_t n);
     1.5  void cx_free_stdlib(cx_allocator a, void* mem);
     1.6  
     1.7 -struct cx_allocator_class {
     1.8 +typedef struct {
     1.9      cx_malloc_func malloc;
    1.10      cx_realloc_func realloc;
    1.11      cx_calloc_func calloc;
    1.12      cx_free_func free;
    1.13 -};
    1.14 +} cx_allocator_class;
    1.15 +
    1.16 +extern cx_allocator_class cx_default_allocator_class;
    1.17  
    1.18  /* HIGH LEVEL API */
    1.19  
    1.20  struct cx_allocator_s {
    1.21 -    struct cx_allocator_class allocatorClass;
    1.22 -    void* data;
    1.23 +    cx_allocator_class *cl;
    1.24 +    cx_allocator data;
    1.25  };
    1.26  typedef struct cx_allocator_s* CxAllocator;
    1.27  

mercurial