--- libaitio/src/Attic/mem.c 2012/05/23 10:56:03 1.1.4.2 +++ libaitio/src/Attic/mem.c 2012/05/23 11:49:35 1.1.4.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: mem.c,v 1.1.4.2 2012/05/23 10:56:03 misho Exp $ +* $Id: mem.c,v 1.1.4.3 2012/05/23 11:49:35 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -170,11 +170,11 @@ mpool_malloc(mpool_t * __restrict mp, u_int size, cons u_int align; if (!mp) { - sess_SetErr(EINVAL, "Pool not specified"); + io_SetErr(EINVAL, "Pool not specified"); return NULL; } if (size > MEM_ALLOC_MAX) { - sess_SetErr(ENOMEM, "Memory size is too large"); + io_SetErr(ENOMEM, "Memory size is too large"); return NULL; } else size = (size + 3) & ~3; /* must align to 4 because needed room for sentinels */ @@ -188,7 +188,7 @@ mpool_malloc(mpool_t * __restrict mp, u_int size, cons /* quota */ if (mp->pool_quota.max && (mp->pool_quota.curr + size) > mp->pool_quota.max) { - sess_SetErr(ENOMEM, "Max.allocate memory quota has been reached"); + io_SetErr(ENOMEM, "Max.allocate memory quota has been reached"); mpool_unlock(mp); return NULL; } @@ -251,12 +251,12 @@ mpool_realloc(mpool_t * __restrict mp, void * __restri return mpool_malloc(mp, newsize, memname); if (!mp) { - sess_SetErr(EINVAL, "Pool not specified"); + io_SetErr(EINVAL, "Pool not specified"); return NULL; } /* check address range & sentinel */ if (MEM_BADADDR(data) || MEM_CORRUPT(data)) { - sess_SetErr(EFAULT, "Corrupted memory address"); + io_SetErr(EFAULT, "Corrupted memory address"); return NULL; } else { osize = ((u_int*)data)[-2] * sizeof(u_int); @@ -264,7 +264,7 @@ mpool_realloc(mpool_t * __restrict mp, void * __restri } /* prepare new size */ if (newsize > MEM_ALLOC_MAX) { - sess_SetErr(ENOMEM, "Memory size is too large"); + io_SetErr(ENOMEM, "Memory size is too large"); return NULL; } else { newsize = (newsize + 3) & ~3; /* must align to 4 because needed room for sentinels */ @@ -276,7 +276,7 @@ mpool_realloc(mpool_t * __restrict mp, void * __restri /* quota */ if (mp->pool_quota.max && (mp->pool_quota.curr + ((u_long) newsize - osize)) > mp->pool_quota.max) { - sess_SetErr(ENOMEM, "Max.allocate memory quota has been reached"); + io_SetErr(ENOMEM, "Max.allocate memory quota has been reached"); mpool_unlock(mp); return NULL; } @@ -297,7 +297,7 @@ mpool_realloc(mpool_t * __restrict mp, void * __restri /* memory block not found! */ if (!m) { mpool_unlock(mp); - sess_SetErr(EFAULT, "Memory block not found"); + io_SetErr(EFAULT, "Memory block not found"); return NULL; } @@ -354,7 +354,7 @@ mpool_purge(mpool_t * __restrict mp, u_int atmost) struct tagAlloc *m, *tmp; if (!mp) { - sess_SetErr(EINVAL, "Pool not specified"); + io_SetErr(EINVAL, "Pool not specified"); return -1; } @@ -403,12 +403,12 @@ mpool_free(mpool_t * __restrict mp, void * __restrict struct tagAlloc *m, *tmp; if (!mp) { - sess_SetErr(EINVAL, "Pool not specified"); + io_SetErr(EINVAL, "Pool not specified"); return -1; } /* check address range & sentinel */ if (MEM_BADADDR(data) || MEM_CORRUPT(data)) { - sess_SetErr(EFAULT, "Corrupted memory address"); + io_SetErr(EFAULT, "Corrupted memory address"); return -2; } else idx = BucketIndex(((u_int*)data)[-2] * sizeof(u_int)); @@ -460,7 +460,7 @@ mpool_free2(mpool_t * __restrict mp, u_int size, const struct tagAlloc *m, *tmp; if (!mp || !memname) { - sess_SetErr(EINVAL, "Pool or memory name is not specified"); + io_SetErr(EINVAL, "Pool or memory name is not specified"); return -1; } else idx = BucketIndex(size);