ucx/mempool.c

changeset 57
e18157c52985
parent 50
ff194559eb41
child 69
fb59270b1de3
equal deleted inserted replaced
56:76caac0da4a0 57:e18157c52985
3 */ 3 */
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <string.h> 6 #include <string.h>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <errno.h>
9 8
10 #include "mempool.h" 9 #include "mempool.h"
11 10
12 typedef struct { 11 typedef struct {
13 ucx_destructor destructor; 12 ucx_destructor destructor;
40 } 39 }
41 40
42 int ucx_mempool_chcap(UcxMempool *pool, size_t newcap) { 41 int ucx_mempool_chcap(UcxMempool *pool, size_t newcap) {
43 void **data = realloc(pool->data, newcap*sizeof(void*)); 42 void **data = realloc(pool->data, newcap*sizeof(void*));
44 if (data == NULL) { 43 if (data == NULL) {
45 return ENOMEM; 44 return 1;
46 } else { 45 } else {
47 pool->data = data; 46 pool->data = data;
48 pool->size = newcap; 47 pool->size = newcap;
49 return EXIT_SUCCESS; 48 return EXIT_SUCCESS;
50 } 49 }

mercurial