From f1832c997863fee1dc8317bac3aac81afd154ecb Mon Sep 17 00:00:00 2001 From: Brian Pane Date: Mon, 29 Apr 2002 01:03:17 +0000 Subject: [PATCH] Because mod_imap's handler runs on every request in the default configuration, rearrange the code to keep it from allocating a few pages worth of local variables on the stack on requests that don't use imagemaps git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@94849 13f79535-47bb-0310-9956-ffa450edef68 --- modules/mappers/mod_imap.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/modules/mappers/mod_imap.c b/modules/mappers/mod_imap.c index 7bde235867..6013cb94e7 100644 --- a/modules/mappers/mod_imap.c +++ b/modules/mappers/mod_imap.c @@ -607,7 +607,7 @@ static void menu_footer(request_rec *r) ap_rputs("\n\n\n\n", r); /* finish the menu */ } -static int imap_handler(request_rec *r) +static int imap_handler_internal(request_rec *r) { char input[MAX_STRING_LEN]; char *directive; @@ -635,10 +635,6 @@ static int imap_handler(request_rec *r) ap_configfile_t *imap; - if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE) - && strcmp(r->handler, "imap-file"))) - return DECLINED; - icr = ap_get_module_config(r->per_dir_config, &imap_module); imap_menu = icr->imap_menu ? icr->imap_menu : IMAP_MENU_DEFAULT; @@ -908,6 +904,21 @@ menu_bail: return HTTP_INTERNAL_SERVER_ERROR; } +static int imap_handler(request_rec *r) +{ + /* Optimizatoin: skip the allocation of large local variables on the + * stack (in imap_handler_internal()) on requests that aren't using + * imagemaps + */ + if (r->method_number != M_GET || (strcmp(r->handler,IMAP_MAGIC_TYPE) + && strcmp(r->handler, "imap-file"))) { + return DECLINED; + } + else { + return imap_handler_internal(r); + } +} + static void register_hooks(apr_pool_t *p) { ap_hook_handler(imap_handler,NULL,NULL,APR_HOOK_MIDDLE); -- 2.40.0