fix cxBufferMinimumCapacity not using the allocator

Sun, 24 Apr 2022 17:44:52 +0200

author
Mike Becker <universe@uap-core.de>
date
Sun, 24 Apr 2022 17:44:52 +0200
changeset 534
0e893f84a7dd
parent 533
8d70ad8da899
child 535
2ff6e9184468

fix cxBufferMinimumCapacity not using the allocator

src/buffer.c file | annotate | diff | comparison | revisions
     1.1 --- a/src/buffer.c	Sun Apr 24 17:29:34 2022 +0200
     1.2 +++ b/src/buffer.c	Sun Apr 24 17:44:52 2022 +0200
     1.3 @@ -119,9 +119,7 @@
     1.4          return 0;
     1.5      }
     1.6  
     1.7 -    unsigned char *newspace = realloc(buffer->bytes, newcap);
     1.8 -    if (newspace) {
     1.9 -        buffer->bytes = newspace;
    1.10 +    if (cxReallocate(buffer->allocator, &buffer->bytes, newcap) == 0) {
    1.11          buffer->capacity = newcap;
    1.12          return 0;
    1.13      } else {

mercurial