src/allocator.c

changeset 450
7960298039cf
parent 434
38ee262e8b94
child 452
a10c3e127050
     1.1 --- a/src/allocator.c	Sun Oct 03 10:43:31 2021 +0200
     1.2 +++ b/src/allocator.c	Sun Oct 03 12:02:57 2021 +0200
     1.3 @@ -30,26 +30,27 @@
     1.4  
     1.5  #include <stdlib.h>
     1.6  
     1.7 -__attribute__((malloc))
     1.8 -void *cx_malloc_stdlib(__attribute__((unused)) void *d, size_t n) {
     1.9 +__attribute__((__malloc__))
    1.10 +static void *cx_malloc_stdlib(__attribute__((__unused__)) void *d, size_t n) {
    1.11      return malloc(n);
    1.12  }
    1.13  
    1.14 -void *cx_realloc_stdlib(__attribute__((unused)) void *d, void *mem, size_t n) {
    1.15 +__attribute__((__warn_unused_result__))
    1.16 +static void *cx_realloc_stdlib(__attribute__((__unused__)) void *d, void *mem, size_t n) {
    1.17      return realloc(mem, n);
    1.18  }
    1.19  
    1.20 -__attribute__((malloc))
    1.21 -void *cx_calloc_stdlib(__attribute__((unused)) void *d, size_t nelem, size_t n) {
    1.22 +__attribute__((__malloc__))
    1.23 +static void *cx_calloc_stdlib(__attribute__((__unused__)) void *d, size_t nelem, size_t n) {
    1.24      return calloc(nelem, n);
    1.25  }
    1.26  
    1.27 -__attribute__((nonnull))
    1.28 -void cx_free_stdlib(__attribute__((unused)) void *d, void *mem) {
    1.29 +__attribute__((__nonnull__))
    1.30 +static void cx_free_stdlib(__attribute__((__unused__)) void *d, void *mem) {
    1.31      free(mem);
    1.32  }
    1.33  
    1.34 -cx_allocator_class cx_default_allocator_class = {
    1.35 +static cx_allocator_class cx_default_allocator_class = {
    1.36          cx_malloc_stdlib,
    1.37          cx_realloc_stdlib,
    1.38          cx_calloc_stdlib,
    1.39 @@ -73,7 +74,7 @@
    1.40  }
    1.41  
    1.42  int cxReallocate(CxAllocator allocator, void **mem, size_t n) {
    1.43 -    void* nmem = allocator->cl->realloc(allocator->data, *mem, n);
    1.44 +    void *nmem = allocator->cl->realloc(allocator->data, *mem, n);
    1.45      if (nmem == NULL) {
    1.46          return 1;
    1.47      } else {

mercurial