httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject cvs commit: httpd-2.0/server core.c protocol.c util_filter.c
Date Tue, 11 Sep 2001 18:38:21 GMT
rbb         01/09/11 11:38:21

  Modified:    include  http_protocol.h util_filter.h
               server   core.c protocol.c util_filter.c
  Log:
  A very small optimization to the OLD_WRITE logic.  This just makes us store
  a pointer to the OLD_WRITE frec, and instead of using strcmp or strcasecmp,
  we can just do a simple pointer comparison.  This optimization is also
  available to other modules.
  
  Revision  Changes    Path
  1.64      +5 -0      httpd-2.0/include/http_protocol.h
  
  Index: http_protocol.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/http_protocol.h,v
  retrieving revision 1.63
  retrieving revision 1.64
  diff -u -r1.63 -r1.64
  --- http_protocol.h	2001/08/25 22:56:22	1.63
  +++ http_protocol.h	2001/09/11 18:38:21	1.64
  @@ -74,6 +74,11 @@
    * @package HTTP protocol handling
    */
   
  +/* This is an optimization.  We keep a record of the filter_rec that
  + * stores the old_write filter, so that we can avoid strcmp's later.
  + */
  +AP_DECLARE_DATA extern ap_filter_rec_t *ap_old_write_func;
  +
   /*
    * Prototypes for routines which either talk directly back to the user,
    * or control the ones that eventually do.
  
  
  
  1.59      +2 -2      httpd-2.0/include/util_filter.h
  
  Index: util_filter.h
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/include/util_filter.h,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- util_filter.h	2001/08/27 06:00:51	1.58
  +++ util_filter.h	2001/09/11 18:38:21	1.59
  @@ -300,7 +300,7 @@
    *        AP_FTYPE_CONNECTION
    * @see add_input_filter()
    */
  -AP_DECLARE(void) ap_register_input_filter(const char *name,
  +AP_DECLARE(ap_filter_rec_t *) ap_register_input_filter(const char *name,
   					  ap_in_filter_func filter_func,
   					  ap_filter_type ftype);
   /**
  @@ -315,7 +315,7 @@
    *              ::AP_FTYPE_CONNECTION
    * @see ap_add_output_filter()
    */
  -AP_DECLARE(void) ap_register_output_filter(const char *name,
  +AP_DECLARE(ap_filter_rec_t *) ap_register_output_filter(const char *name,
   					    ap_out_filter_func filter_func,
   					    ap_filter_type ftype);
   
  
  
  
  1.59      +2 -2      httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.58
  retrieving revision 1.59
  diff -u -r1.58 -r1.59
  --- core.c	2001/08/31 13:45:16	1.58
  +++ core.c	2001/09/11 18:38:21	1.59
  @@ -3419,8 +3419,8 @@
       ap_register_output_filter("CORE", core_output_filter, AP_FTYPE_NETWORK);
       ap_register_output_filter("SUBREQ_CORE", ap_sub_req_output_filter, 
                                 AP_FTYPE_CONTENT);
  -    ap_register_output_filter("OLD_WRITE", ap_old_write_filter,
  -                              AP_FTYPE_CONTENT - 1);
  +    ap_old_write_func = ap_register_output_filter("OLD_WRITE", 
  +                                   ap_old_write_filter, AP_FTYPE_CONTENT - 1);
   }
   
   AP_DECLARE_DATA module core_module = {
  
  
  
  1.44      +3 -1      httpd-2.0/server/protocol.c
  
  Index: protocol.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/protocol.c,v
  retrieving revision 1.43
  retrieving revision 1.44
  diff -u -r1.43 -r1.44
  --- protocol.c	2001/09/04 07:59:55	1.43
  +++ protocol.c	2001/09/11 18:38:21	1.44
  @@ -104,6 +104,8 @@
   	    APR_HOOK_LINK(default_port)
   )
   
  +AP_DECLARE_DATA ap_filter_rec_t *ap_old_write_func;
  +
   /*
    * Builds the content-type that should be sent to the client from the
    * content-type specified.  The following rules are followed:
  @@ -1064,7 +1066,7 @@
   
       /* this will typically exit on the first test */
       for (f = r->output_filters; f != NULL; f = f->next)
  -        if (strcasecmp("OLD_WRITE", f->frec->name) == 0)
  +        if (ap_old_write_func == f->frec)
               break;
       if (f == NULL) {
           /* our filter hasn't been added yet */
  
  
  
  1.69      +6 -5      httpd-2.0/server/util_filter.c
  
  Index: util_filter.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/util_filter.c,v
  retrieving revision 1.68
  retrieving revision 1.69
  diff -u -r1.68 -r1.69
  --- util_filter.c	2001/09/04 16:28:45	1.68
  +++ util_filter.c	2001/09/11 18:38:21	1.69
  @@ -91,7 +91,7 @@
       return APR_SUCCESS;
   }
   
  -static void register_filter(const char *name,
  +static ap_filter_rec_t *register_filter(const char *name,
                               ap_filter_func filter_func,
                               ap_filter_type ftype,
                               apr_hash_t **reg_filter_set)
  @@ -111,24 +111,25 @@
   
       apr_pool_cleanup_register(FILTER_POOL, NULL, filter_cleanup, 
                                 apr_pool_cleanup_null);
  +    return frec;
   }
   
  -AP_DECLARE(void) ap_register_input_filter(const char *name,
  +AP_DECLARE(ap_filter_rec_t *) ap_register_input_filter(const char *name,
                                             ap_in_filter_func filter_func,
                                             ap_filter_type ftype)
   {
       ap_filter_func f;
       f.in_func = filter_func;
  -    register_filter(name, f, ftype, &registered_input_filters);
  +    return register_filter(name, f, ftype, &registered_input_filters);
   }                                                                    
   
  -AP_DECLARE(void) ap_register_output_filter(const char *name,
  +AP_DECLARE(ap_filter_rec_t *) ap_register_output_filter(const char *name,
                                              ap_out_filter_func filter_func,
                                              ap_filter_type ftype)
   {
       ap_filter_func f;
       f.out_func = filter_func;
  -    register_filter(name, f, ftype, &registered_output_filters);
  +    return register_filter(name, f, ftype, &registered_output_filters);
   }
   
   static ap_filter_t *add_any_filter(const char *name, void *ctx, 
  
  
  

Mime
View raw message