[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Static pools?

From: Matthew Hambley <matthew_at_aether.demon.co.uk>
Date: 2003-03-08 18:09:17 CET

I want a block of memory which will last across calls to a function. i.e.
a static, global to my source file. How do I go about achieving this with
the memory pool system used by APR? Presumably I can't simply say:

  static FirstRun = (1 == 1);
  static BigOlStruc *TheStruc;

  void TheFunc(apr_pool_t *pool)
  {
    if (FirstRun) {
      TheStruc = apr_palloc(sizeof(BigOlStruc), pool);
      FirstRun = (1 == 0);
    }
    ...

All sorts of crazy stuff might happen while I'm away, I could come back
and find that my memory has been de-allocated.

-- 
(\/)atthew )-(ambley ---------------\ If something's worth doing it's worth
E-mail : matthew@aether.demon.co.uk  \ doing badly until you can learn to
Public key : C991137B                 \ do it well.
Web : http://www.aether.demon.co.uk/   \-----------------------------------
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 8 18:10:46 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.