src/allocator.c

changeset 508
8aea65ae1eaf
parent 500
eb9e7bd40a8e
child 628
1e2be40f0cb5
     1.1 --- a/src/allocator.c	Sun Mar 06 13:57:36 2022 +0100
     1.2 +++ b/src/allocator.c	Sat Apr 09 16:37:43 2022 +0200
     1.3 @@ -31,22 +31,36 @@
     1.4  #include <stdlib.h>
     1.5  
     1.6  __attribute__((__malloc__, __alloc_size__(2)))
     1.7 -static void *cx_malloc_stdlib(__attribute__((__unused__)) void *d, size_t n) {
     1.8 +static void *cx_malloc_stdlib(
     1.9 +        __attribute__((__unused__)) void *d,
    1.10 +        size_t n
    1.11 +) {
    1.12      return malloc(n);
    1.13  }
    1.14  
    1.15  __attribute__((__warn_unused_result__, __alloc_size__(3)))
    1.16 -static void *cx_realloc_stdlib(__attribute__((__unused__)) void *d, void *mem, size_t n) {
    1.17 +static void *cx_realloc_stdlib(
    1.18 +        __attribute__((__unused__)) void *d,
    1.19 +        void *mem,
    1.20 +        size_t n
    1.21 +) {
    1.22      return realloc(mem, n);
    1.23  }
    1.24  
    1.25  __attribute__((__malloc__, __alloc_size__(2, 3)))
    1.26 -static void *cx_calloc_stdlib(__attribute__((__unused__)) void *d, size_t nelem, size_t n) {
    1.27 +static void *cx_calloc_stdlib(
    1.28 +        __attribute__((__unused__)) void *d,
    1.29 +        size_t nelem,
    1.30 +        size_t n
    1.31 +) {
    1.32      return calloc(nelem, n);
    1.33  }
    1.34  
    1.35  __attribute__((__nonnull__))
    1.36 -static void cx_free_stdlib(__attribute__((__unused__)) void *d, void *mem) {
    1.37 +static void cx_free_stdlib(
    1.38 +        __attribute__((__unused__)) void *d,
    1.39 +        void *mem
    1.40 +) {
    1.41      free(mem);
    1.42  }
    1.43  
    1.44 @@ -66,14 +80,14 @@
    1.45  /* IMPLEMENTATION OF HIGH LEVEL API */
    1.46  
    1.47  void *cxMalloc(
    1.48 -        CxAllocator *allocator,
    1.49 +        CxAllocator const *allocator,
    1.50          size_t n
    1.51  ) {
    1.52      return allocator->cl->malloc(allocator->data, n);
    1.53  }
    1.54  
    1.55  void *cxRealloc(
    1.56 -        CxAllocator *allocator,
    1.57 +        CxAllocator const *allocator,
    1.58          void *mem,
    1.59          size_t n
    1.60  ) {
    1.61 @@ -81,7 +95,7 @@
    1.62  }
    1.63  
    1.64  int cxReallocate(
    1.65 -        CxAllocator *allocator,
    1.66 +        CxAllocator const *allocator,
    1.67          void **mem,
    1.68          size_t n
    1.69  ) {
    1.70 @@ -95,7 +109,7 @@
    1.71  }
    1.72  
    1.73  void *cxCalloc(
    1.74 -        CxAllocator *allocator,
    1.75 +        CxAllocator const *allocator,
    1.76          size_t nelem,
    1.77          size_t n
    1.78  ) {
    1.79 @@ -103,7 +117,7 @@
    1.80  }
    1.81  
    1.82  void cxFree(
    1.83 -        CxAllocator *allocator,
    1.84 +        CxAllocator const *allocator,
    1.85          void *mem
    1.86  ) {
    1.87      allocator->cl->free(allocator->data, mem);

mercurial