Return-Path: Delivered-To: apmail-httpd-dev-archive@httpd.apache.org Received: (qmail 53801 invoked by uid 500); 24 Apr 2002 17:55:01 -0000 Mailing-List: contact dev-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: list-post: Delivered-To: mailing list dev@httpd.apache.org Received: (qmail 53777 invoked from network); 24 Apr 2002 17:55:01 -0000 X-Authentication-Warning: cancer.clove.org: jerenk set sender to jerenkrantz@apache.org using -f Date: Wed, 24 Apr 2002 10:55:05 -0700 From: Justin Erenkrantz To: dev@httpd.apache.org Subject: Re: cvs commit: httpd-2.0/server core.c Message-ID: <20020424105505.E15450@apache.org> Mail-Followup-To: Justin Erenkrantz , dev@httpd.apache.org References: <20020424143129.6079.qmail@icarus.apache.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5i In-Reply-To: <20020424143129.6079.qmail@icarus.apache.org>; from gregames@apache.org on Wed, Apr 24, 2002 at 02:31:29PM -0000 X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N On Wed, Apr 24, 2002 at 02:31:29PM -0000, gregames@apache.org wrote: > gregames 02/04/24 07:31:28 > > Modified: server core.c > Log: > default_handler: short circuit the method checks. Move the code to deal > with unusual methods to the end of function to reduce i-cache clutter. Can't we live without the goto? Move those statements inside if (r->method_number != M_GET && r->method_number != M_POST) { check? "goto statement considered harmful." You'd make the common case faster, but please let's not worry about the instruction cache. -- justin > Revision Changes Path > 1.171 +13 -11 httpd-2.0/server/core.c > > Index: core.c > =================================================================== > RCS file: /home/cvs/httpd-2.0/server/core.c,v > retrieving revision 1.170 > retrieving revision 1.171 > diff -u -r1.170 -r1.171 > --- core.c 22 Apr 2002 08:08:38 -0000 1.170 > +++ core.c 24 Apr 2002 14:31:28 -0000 1.171 > @@ -3167,18 +3167,8 @@ > return errstatus; > } > > - if (r->method_number == M_INVALID) { > - ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, > - "Invalid method in request %s", r->the_request); > - return HTTP_NOT_IMPLEMENTED; > - } > - > - if (r->method_number == M_OPTIONS) { > - return ap_send_http_options(r); > - } > - > if (r->method_number != M_GET && r->method_number != M_POST) { > - return HTTP_METHOD_NOT_ALLOWED; > + goto unusual_method; > } > > if (r->finfo.filetype == 0) { > @@ -3248,6 +3238,18 @@ > APR_BRIGADE_INSERT_TAIL(bb, e); > > return ap_pass_brigade(r->output_filters, bb); > + > +unusual_method: > + if (r->method_number == M_INVALID) { > + ap_log_rerror(APLOG_MARK, APLOG_NOERRNO|APLOG_ERR, 0, r, > + "Invalid method in request %s", r->the_request); > + return HTTP_NOT_IMPLEMENTED; > + } > + > + if (r->method_number == M_OPTIONS) { > + return ap_send_http_options(r); > + } > + return HTTP_METHOD_NOT_ALLOWED; > } > > static int net_time_filter(ap_filter_t *f, apr_bucket_brigade *b, > > >