perl-modperl-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject cvs commit: modperl-2.0/src/modules/perl modperl_io_apache.c modperl_util.h
Date Thu, 13 May 2004 01:28:39 GMT
stas        2004/05/12 18:28:39

  Modified:    src/modules/perl modperl_io_apache.c modperl_util.h
  Log:
  rename the string truncation macro and move it into a common header file
  so we can reuse it in other .c files
  
  Revision  Changes    Path
  1.19      +7 -17     modperl-2.0/src/modules/perl/modperl_io_apache.c
  
  Index: modperl_io_apache.c
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_io_apache.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -u -r1.18 -r1.19
  --- modperl_io_apache.c	4 May 2004 06:19:11 -0000	1.18
  +++ modperl_io_apache.c	13 May 2004 01:28:39 -0000	1.19
  @@ -15,16 +15,6 @@
   
   #include "mod_perl.h"
   
  -/* not too long so it won't wrap when posted in email */
  -#define IO_DUMP_LENGTH 35
  -/* dumping hundreds of lines in the trace, makes it hard to read. Get
  - * a string chunk of IO_DUMP_LENGTH or less */
  -#define IO_DUMP_FIRST_CHUNK(p, str, count)       \
  -    count < IO_DUMP_LENGTH                       \
  -        ? (char *)str                            \
  -        : (char *)apr_psprintf(p, "%s...",       \
  -                               apr_pstrmemdup(p, str, IO_DUMP_LENGTH))
  -
   #ifdef MP_IO_TIE_PERLIO
   
   /***************************
  @@ -152,7 +142,7 @@
       MP_CHECK_WBUCKET_INIT("print");
   
       MP_TRACE_o(MP_FUNC, "%4db [%s]", count,
  -               IO_DUMP_FIRST_CHUNK(rcfg->wbucket->pool, vbuf, count));
  +               MP_TRACE_STR_TRUNC(rcfg->wbucket->pool, vbuf, count));
           
       rv = modperl_wbucket_write(aTHX_ rcfg->wbucket, vbuf, &count);
       if (rv != APR_SUCCESS) {
  @@ -184,11 +174,11 @@
       MP_CHECK_WBUCKET_INIT("flush");
   
       MP_TRACE_o(MP_FUNC, "%4db [%s]", rcfg->wbucket->outcnt,
  -               IO_DUMP_FIRST_CHUNK(rcfg->wbucket->pool,
  -                                   apr_pstrmemdup(rcfg->wbucket->pool,
  -                                                  rcfg->wbucket->outbuf,
  -                                                  rcfg->wbucket->outcnt),
  -                                   rcfg->wbucket->outcnt));
  +               MP_TRACE_STR_TRUNC(rcfg->wbucket->pool,
  +                                  apr_pstrmemdup(rcfg->wbucket->pool,
  +                                                 rcfg->wbucket->outbuf,
  +                                                 rcfg->wbucket->outcnt),
  +                                  rcfg->wbucket->outcnt));
   
       MP_FAILURE_CROAK(modperl_wbucket_flush(rcfg->wbucket, FALSE));
   
  @@ -365,7 +355,7 @@
       apr_brigade_destroy(bb);
   
       MP_TRACE_o(MP_FUNC, "wanted %db, read %db [%s]", wanted, total,
  -               IO_DUMP_FIRST_CHUNK(r->pool, buffer, total));
  +               MP_TRACE_STR_TRUNC(r->pool, buffer, total));
   
       return total;
   }
  
  
  
  1.59      +10 -0     modperl-2.0/src/modules/perl/modperl_util.h
  
  Index: modperl_util.h
  ===================================================================
  RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.h,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -u -r1.58 -r1.59
  --- modperl_util.h	10 May 2004 18:09:14 -0000	1.58
  +++ modperl_util.h	13 May 2004 01:28:39 -0000	1.59
  @@ -214,4 +214,14 @@
   #define MP_TRACEv__PERLID
   #endif /* USE_ITHREADS */
   
  +/* dumping hundreds of lines in the trace, makes it less useful. Get a
  + * string chunk of MP_TRACE_STR_LEN or less. Not too long so it won't
  + * wrap when posted in email */
  +#define MP_TRACE_STR_LEN 35
  +#define MP_TRACE_STR_TRUNC(p, str, count)                                \
  +    count < MP_TRACE_STR_LEN                                             \
  +        ? (char *)apr_pstrmemdup(p, str, count)                          \
  +        : (char *)apr_psprintf(p, "%s...",                               \
  +                               apr_pstrmemdup(p, str, MP_TRACE_STR_LEN))
  +
   #endif /* MODPERL_UTIL_H */
  
  
  

Mime
View raw message