--- libaitsess/src/Attic/mem.c 2012/02/27 23:57:12 1.1.2.3 +++ libaitsess/src/Attic/mem.c 2012/02/28 00:13:26 1.1.2.4 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: mem.c,v 1.1.2.3 2012/02/27 23:57:12 misho Exp $ +* $Id: mem.c,v 1.1.2.4 2012/02/28 00:13:26 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -235,9 +235,9 @@ mpool_malloc(mpool_t * __restrict mp, u_int size, cons * return: -1 error or 0 ok */ int -mpool_purge(mpool_t * __restrict mp, int atmost) +mpool_purge(mpool_t * __restrict mp, u_int atmost) { - register int i, cx = 0; + register int i, cx; struct tagAlloc *m, *tmp; if (!mp) { @@ -247,11 +247,13 @@ mpool_purge(mpool_t * __restrict mp, int atmost) mpool_lock(mp); - for (i = 0; i < MEM_BUCKETS; i++) { + for (i = cx = 0; i < MEM_BUCKETS; cx = 0, i++) { TAILQ_FOREACH_SAFE(m, &mp->pool_inactive[i], alloc_node, tmp) { - /* count barrier for purge */ - if (cx++ < atmost) + /* barrier for purge */ + if (cx < atmost) { + cx++; continue; + } TAILQ_REMOVE(&mp->pool_inactive[i], m, alloc_node); /* statistics */