httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Greg Stein <gst...@lyra.org>
Subject Re: cvs commit: apache-2.0/src/lib/apr/lib apr_execve.c apr_pools.c apr_tables.c
Date Wed, 24 Nov 1999 13:55:21 GMT
On Wed, 24 Nov 1999, Ryan Bloom wrote:
> > How about using something like the C++ method where you can register an out
> > of memory handler function (set_new_handler())? That way Apache can register
> > a handler that does the log & abort step without forcing all APR using apps
> > to have the same behaviour.
> 
> I could live with that, presuming that the APR default is to jut return an
> error code.  If Apache wants to over-write that default, then fine.  I
> won't get to this code until after Thanksgiving, because I want to get
> everybodies reaction first.

You could probably do something like this:

#define ap_memory_error(ctx)  ((ctx) != NULL \
                               && (ctx)->notify_no_memory != NULL \
        ? (*(ctx)->notify_no_memory)(ctx)    \
        : APR_ENOMEMORY)

(of course, it could be a real function, too)

Code would then look like:

  p = malloc(foo);
  if (p == NULL)
    return ap_memory_error(ctx);
  p->bar = baz;
  ...


Seem reasonable?

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/


Mime
View raw message