From: Ben Hyde Date: Thu, 7 Oct 1999 14:32:06 +0000 (+0000) Subject: Man! This file vastly improved. Thanks Dean! X-Git-Tag: 1.3.10~302 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9bbc5288b2323b014923e3c19b62f73ffbea7bb2;p=thirdparty%2Fapache%2Fhttpd.git Man! This file vastly improved. Thanks Dean! Use the abstraction API_EXPORT_NONSTD for exporting main (aka apache_main). Use clear rather than destroy on ptemp as other 'systolic' pools do. That also fixing a leak of the first ptemp created. Let the destroy of pglobal to all the cleanup. Meanwhile, all exit paths should destroy pglobal so the cleanup/unwind gets run and this routine sets a bad example by having many exits that don't - another day. PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@83939 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/server/main.c b/server/main.c index 60ee4e4a266..44e031fceac 100644 --- a/server/main.c +++ b/server/main.c @@ -237,10 +237,9 @@ ap_context_t *g_pHookPool; extern char *optarg; #ifdef WIN32 -__declspec(dllexport) - int apache_main(int argc, char *argv[]) +API_EXPORT_NONSTD(int) apache_main(int argc, char *argv[]) #else -int main(int argc, char **argv) +API_EXPORT_NONSTD(int) main(int argc, char *argv[]) #endif { int c; @@ -339,21 +338,17 @@ int main(int argc, char **argv) for (;;) { ap_clear_pool(pconf); - ap_create_context(&ptemp, pconf); + ap_clear_pool(ptemp); ap_server_root = def_server_root; ap_run_pre_config(pconf, plog, ptemp); server_conf = ap_read_config(pconf, ptemp, confname); ap_clear_pool(plog); ap_run_open_logs(pconf, plog, ptemp, server_conf); ap_post_config_hook(pconf, plog, ptemp, server_conf); - ap_destroy_pool(ptemp); if (ap_mpm_run(pconf, plog, server_conf)) break; } - - ap_clear_pool(pconf); - ap_clear_pool(plog); - ap_destroy_pool(pglobal); + ap_destroy_pool(pglobal); /* and destroy all descendent pools */ exit(0); }