httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bri...@apache.org
Subject cvs commit: httpd-2.0/modules/loggers mod_log_config.c
Date Sun, 06 Jan 2002 21:03:51 GMT
brianp      02/01/06 13:03:51

  Modified:    modules/loggers mod_log_config.c
  Log:
  Rearranged the log_request_time() code to eliminate the allocation
  of an 8KB buffer on the stack when not using a custom time format
  
  Revision  Changes    Path
  1.74      +16 -4     httpd-2.0/modules/loggers/mod_log_config.c
  
  Index: mod_log_config.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/loggers/mod_log_config.c,v
  retrieving revision 1.73
  retrieving revision 1.74
  diff -u -r1.73 -r1.74
  --- mod_log_config.c	6 Jan 2002 08:01:34 -0000	1.73
  +++ mod_log_config.c	6 Jan 2002 21:03:51 -0000	1.74
  @@ -446,10 +446,18 @@
       return NULL;
   }
   
  +static const char *log_request_time_custom(request_rec *r, char *a,
  +                                           apr_exploded_time_t *xt)
  +{
  +    apr_size_t retcode;
  +    char tstr[MAX_STRING_LEN];
  +    apr_strftime(tstr, &retcode, sizeof(tstr), a, xt);
  +    return apr_pstrdup(r->pool, tstr);
  +}
  +
   static const char *log_request_time(request_rec *r, char *a)
   {
       apr_exploded_time_t xt;
  -    apr_size_t retcode;
   
       /*
   	hi.  i think getting the time again at the end of the request
  @@ -468,9 +476,13 @@
       ap_explode_recent_localtime(&xt, r->request_time);
   #endif
       if (a && *a) {              /* Custom format */
  -        char tstr[MAX_STRING_LEN];
  -        apr_strftime(tstr, &retcode, sizeof(tstr), a, &xt);
  -        return apr_pstrdup(r->pool, tstr);
  +        /* The custom time formatting uses a very large temp buffer
  +         * on the stack.  To avoid using so much stack space in the
  +         * common case where we're not using a custom format, the code
  +         * for the custom format in a separate function.  (That's why
  +         * log_request_time_custom is not inlined right here.)
  +         */
  +        return log_request_time_custom(r, a, &xt);
       }
       else {                      /* CLF format */
   	char sign;
  
  
  

Mime
View raw message