|
version 1.9, 2022/10/24 00:10:22
|
version 1.10, 2024/08/14 16:05:42
|
|
Line 12 terms:
|
Line 12 terms:
|
| All of the documentation and software included in the ELWIX and AITNET |
All of the documentation and software included in the ELWIX and AITNET |
| Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
Releases is copyrighted by ELWIX - Sofia/Bulgaria <info@elwix.org> |
| |
|
| Copyright 2004 - 2022 | Copyright 2004 - 2024 |
| by Michael Pounov <misho@elwix.org>. All rights reserved. |
by Michael Pounov <misho@elwix.org>. All rights reserved. |
| |
|
| Redistribution and use in source and binary forms, with or without |
Redistribution and use in source and binary forms, with or without |
|
Line 94 mpool_destroy(mpool_t ** __restrict mp)
|
Line 94 mpool_destroy(mpool_t ** __restrict mp)
|
| struct tagAlloc *m; |
struct tagAlloc *m; |
| register int i; |
register int i; |
| |
|
| if (!mp && !*mp) | if (!mp || !*mp) |
| return; |
return; |
| |
|
| mpool_lock(*mp); |
mpool_lock(*mp); |
|
Line 219 mpool_malloc(mpool_t * __restrict mp, u_int size, cons
|
Line 219 mpool_malloc(mpool_t * __restrict mp, u_int size, cons
|
| } else { /* quota */ |
} else { /* quota */ |
| mp->pool_quota.curr += size; |
mp->pool_quota.curr += size; |
| mp->pool_quota.real += 1 << (idx + MEM_MIN_BUCKET); |
mp->pool_quota.real += 1 << (idx + MEM_MIN_BUCKET); |
| |
#ifdef MPOOL_MEM_ZERO |
| memset(m->alloc_mem, 0, align + 12); |
memset(m->alloc_mem, 0, align + 12); |
| |
#endif |
| } |
} |
| } |
} |
| |
|
|
Line 236 mpool_malloc(mpool_t * __restrict mp, u_int size, cons
|
Line 238 mpool_malloc(mpool_t * __restrict mp, u_int size, cons
|
| } |
} |
| |
|
| /* |
/* |
| |
* mpool_calloc() - Multiple memory block allocation |
| |
* |
| |
* @mp = Memory pool |
| |
* @nmemb = Number of memory blocks |
| |
* @size = Size |
| |
* @memname = Optional memory block name |
| |
* return: NULL error or !=NULL ok allocated memory |
| |
*/ |
| |
void * |
| |
mpool_calloc(mpool_t * __restrict mp, u_int nmemb, u_int size, const char *memname) |
| |
{ |
| |
void *m; |
| |
u_int total = nmemb * size; |
| |
|
| |
m = mpool_malloc(mp, total, memname); |
| |
#ifndef MPOOL_MEM_ZERO |
| |
if (m) |
| |
memset(m, 0, total); |
| |
#endif |
| |
return m; |
| |
} |
| |
|
| |
/* |
| * mpool_realloc() Reallocate memory block with new size |
* mpool_realloc() Reallocate memory block with new size |
| * |
* |
| * @mp = Memory pool |
* @mp = Memory pool |
|
Line 668 mpool_xmalloc(size_t size)
|
Line 693 mpool_xmalloc(size_t size)
|
| void * |
void * |
| mpool_xcalloc(size_t num, size_t size) |
mpool_xcalloc(size_t num, size_t size) |
| { |
{ |
| return mpool_malloc(elwix_mpool, num * size, elwix_Prog); | return mpool_calloc(elwix_mpool, num, size, elwix_Prog); |
| } |
} |
| |
|
| /* |
/* |