src/allocator.c

changeset 726
44986c0e2b05
parent 650
77021e06b1a8
     1.1 --- a/src/allocator.c	Tue Jun 27 20:04:48 2023 +0200
     1.2 +++ b/src/allocator.c	Wed Jun 28 19:18:01 2023 +0200
     1.3 @@ -75,6 +75,20 @@
     1.4  };
     1.5  CxAllocator *cxDefaultAllocator = &cx_default_allocator;
     1.6  
     1.7 +
     1.8 +int cx_reallocate(
     1.9 +        void **mem,
    1.10 +        size_t n
    1.11 +) {
    1.12 +    void *nmem = realloc(*mem, n);
    1.13 +    if (nmem == NULL) {
    1.14 +        return 1;
    1.15 +    } else {
    1.16 +        *mem = nmem;
    1.17 +        return 0;
    1.18 +    }
    1.19 +}
    1.20 +
    1.21  // IMPLEMENTATION OF HIGH LEVEL API
    1.22  
    1.23  void *cxMalloc(

mercurial