attached mail follows:
On 1 May 2001, at 16:40, Henrik Nordstrom <hno@hem.passagen.se> wrote:
> Andres Kroonmaa wrote:
> >
> > On 29 Apr 2001, at 2:35, Henrik Nordstrom <hno@hem.passagen.se> wrote:
> >
> > > A fair bit of cleanup remains before this can get committed to HEAD.
> > >
> > > * src/MemPoolStats.c is a mixture of different things, while the name
> > > suggests it should be statistics.. probably much of the non-statistics
> > > things there should be moved to lib/MemPools.c
> >
> > What should I do about that one? rename the file?
>
> No, it is probably a good name, but some stuff should probably move to
> mem.c (maybe even all of it).
Are you *sure*? I'd disagree, because stuff in MemPoolStats.c is very
specific to current memPool implementation, while mem.c is somewhat
free from specifics. Moving lots of stuff to mem.c will clutter it with
stuff that someday may be changed alot.
Sure, ideally all mempool stuff should be in one place, under lib/,
but we can't have eventhandler there, so even if I move all implementation
of event into lib/ I'd need some wrapper under src/ and 2 public funcs
instead of one.
I'm in process of hiding most mempool internal funcs behind a Control
function. Then I could move most of actual work to lib/ but we'd still
need wrappers under src/ for what needs public declarations.
I just wonder if that is a right path.
#define memPoolTune(pool, chunksize, unused) memPoolControl((pool), MPOOL_TUNE_CHUNKSIZE, (chunksize), NULL)
#define memPoolInUseCount(pool) memPoolControl((pool), MPOOL_GET_INUSE, 0, 0)
#define memPoolClean(pool, maxage) memPoolControl((pool), MPOOL_CLEAN_POOL, (maxage), 0)
#define memPoolFlushMeters(pool) memPoolControl((pool), MPOOL_FLUSH_METERS, 0, 0)
int
memPoolControl(MemPool * pool, int cmd, size_t value, void *ptr)
{
int ret = 0;
switch (cmd) {
case MPOOL_TUNE_CHUNKSIZE:
MemPoolTune(pool, value, 0);
break;
case MPOOL_FLUSH_METERS:
memPoolFlushMeters(pool);
break;
case MPOOL_CLEAN_POOL:
MemPoolClean(pool, value);
break;
case MPOOL_INIT:
memArrayInit(ptr);
break;
case MPOOL_GET_INUSE:
ret = MemPoolInUseCount(pool);
break;
default:
ret = -1;
}
return ret;
}
------------------------------------
Andres Kroonmaa <andre@online.ee>
CTO, Delfi Online
Tel: 6501 731, Fax: 6501 708
Pärnu mnt. 158, Tallinn,
11317 Estonia
Received on Wed May 02 2001 - 14:04:34 MDT
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:13:58 MST