src/allocator.c

changeset 1065
6eb7b54975ee
parent 1040
1ecf4dbbc60c
equal deleted inserted replaced
1064:f3b04cd60776 1065:6eb7b54975ee
82 void **mem, 82 void **mem,
83 size_t n 83 size_t n
84 ) { 84 ) {
85 void *nmem = realloc(*mem, n); 85 void *nmem = realloc(*mem, n);
86 if (nmem == NULL) { 86 if (nmem == NULL) {
87 return 1; 87 return 1; // LCOV_EXCL_LINE
88 } else { 88 } else {
89 *mem = nmem; 89 *mem = nmem;
90 return 0; 90 return 0;
91 } 91 }
92 } 92 }
102 errno = EOVERFLOW; 102 errno = EOVERFLOW;
103 return 1; 103 return 1;
104 } else { 104 } else {
105 void *nmem = realloc(*mem, n); 105 void *nmem = realloc(*mem, n);
106 if (nmem == NULL) { 106 if (nmem == NULL) {
107 return 1; 107 return 1; // LCOV_EXCL_LINE
108 } else { 108 } else {
109 *mem = nmem; 109 *mem = nmem;
110 return 0; 110 return 0;
111 } 111 }
112 } 112 }
150 void **mem, 150 void **mem,
151 size_t n 151 size_t n
152 ) { 152 ) {
153 void *nmem = allocator->cl->realloc(allocator->data, *mem, n); 153 void *nmem = allocator->cl->realloc(allocator->data, *mem, n);
154 if (nmem == NULL) { 154 if (nmem == NULL) {
155 return 1; 155 return 1; // LCOV_EXCL_LINE
156 } else { 156 } else {
157 *mem = nmem; 157 *mem = nmem;
158 return 0; 158 return 0;
159 } 159 }
160 } 160 }
166 size_t nmemb, 166 size_t nmemb,
167 size_t size 167 size_t size
168 ) { 168 ) {
169 void *nmem = cxReallocArray(allocator, *mem, nmemb, size); 169 void *nmem = cxReallocArray(allocator, *mem, nmemb, size);
170 if (nmem == NULL) { 170 if (nmem == NULL) {
171 return 1; 171 return 1; // LCOV_EXCL_LINE
172 } else { 172 } else {
173 *mem = nmem; 173 *mem = nmem;
174 return 0; 174 return 0;
175 } 175 }
176 } 176 }

mercurial