MCPcopy Create free account
hub / github.com/acl-dev/acl / acl_slice_pool_alloc

Function acl_slice_pool_alloc

lib_acl/src/stdlib/memory/acl_slice.c:1315–1343  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1313}
1314
1315void *acl_slice_pool_alloc(const char *filename, int line,
1316 ACL_SLICE_POOL *asp, size_t size)
1317{
1318 char *ptr;
1319 int n;
1320
1321 size += sizeof(size_t); /* ͷ�������ռ���Ϊ��־λ */
1322 if (asp == NULL || (int) size >= asp->base * asp->nslice) {
1323 size += sizeof(size_t);
1324 ptr = (char*) __slice_malloc_fn(filename, line, size);
1325 if (ptr) {
1326 *((size_t*) ptr) = size - sizeof(size_t) * 2;
1327 *(((size_t*) ptr) + 1) = 0;
1328 ptr += sizeof(size_t) * 2;
1329 }
1330 return ptr;
1331 }
1332 n = (int) size / asp->base;
1333 if (size % asp->base != 0) {
1334 n++;
1335 }
1336
1337 ptr = (char*) acl_slice_alloc(asp->slices[n - 1]);
1338 if (ptr) {
1339 *((size_t*) ptr) = size - sizeof(size_t);
1340 ptr += sizeof(size_t);
1341 }
1342 return ptr;
1343}
1344
1345void *acl_slice_pool_calloc(const char *filename, int line,
1346 ACL_SLICE_POOL *asp, size_t nmemb, size_t size)

Callers 15

fifo_testFunction · 0.85
acl_vstring_slice_allocFunction · 0.85
acl_vstring_memmoveFunction · 0.85
tls_mem_allocFunction · 0.85
acl_slice_pool_callocFunction · 0.85
acl_slice_pool_reallocFunction · 0.85
acl_slice_pool_memdupFunction · 0.85
acl_slice_pool_strdupFunction · 0.85
acl_slice_pool_strndupFunction · 0.85
htable_sizeFunction · 0.85
acl_htable_enterFunction · 0.85
acl_htable_enter_r2Function · 0.85

Calls 1

acl_slice_allocFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…