You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by br...@apache.org on 2002/04/29 03:03:18 UTC

cvs commit: httpd-2.0/modules/mappers mod_imap.c

brianp      02/04/28 18:03:17

  Modified:    modules/mappers mod_imap.c
  Log:
  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
  
  Revision  Changes    Path
  1.38      +16 -5     httpd-2.0/modules/mappers/mod_imap.c
  
  Index: mod_imap.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/mappers/mod_imap.c,v
  retrieving revision 1.37
  retrieving revision 1.38
  diff -u -r1.37 -r1.38
  --- mod_imap.c	20 Mar 2002 17:41:55 -0000	1.37
  +++ mod_imap.c	29 Apr 2002 01:03:17 -0000	1.38
  @@ -607,7 +607,7 @@
       ap_rputs("\n\n</body>\n</html>\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 @@
   
       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;
  @@ -906,6 +902,21 @@
   	return OK;
       }
       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)