You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by William A Rowe Jr <wr...@rowe-clan.net> on 2016/06/09 00:59:12 UTC
Re: svn commit: r1747469 [1/2] - in /httpd/httpd/trunk: include/
modules/aaa/ modules/cache/ modules/dav/main/ modules/filters/
modules/generators/ modules/http/ modules/http2/ modules/loggers/
modules/mappers/ modules/metadata/ modules/proxy/ modules/ssl/...
Some of these items are dis-optimized by redundant logic that
we seriously aught to clean up, if anyone is looking for some
low hanging fruit.
On Wed, Jun 8, 2016 at 7:06 PM, <wr...@apache.org> wrote:
> Author: wrowe
> Date: Thu Jun 9 00:06:42 2016
> New Revision: 1747469
>
> URL: http://svn.apache.org/viewvc?rev=1747469&view=rev
> Log:
> Rename ap_casecmpstr[n]() to ap_cstr_casecmp[n](), update with APR doxygen
>
A few pre-existing examples of this dis-optimization...
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/cache/cache_storage.c?rev=1747469&r1=1747468&r2=1747469&view=diff
>
> ==============================================================================
> --- httpd/httpd/trunk/modules/cache/cache_storage.c (original)
> +++ httpd/httpd/trunk/modules/cache/cache_storage.c Thu Jun 9 00:06:42
> 2016
> @@ -115,7 +115,7 @@ int cache_create_entity(cache_request_re
>
> static int filter_header_do(void *v, const char *key, const char *val)
> {
> - if ((*key == 'W' || *key == 'w') && !ap_casecmpstr(key, "Warning")
> + if ((*key == 'W' || *key == 'w') && !ap_cstr_casecmp(key, "Warning")
> && *val == '1') {
> /* any stored Warning headers with warn-code 1xx (see section
> * 14.46) MUST be deleted from the cache entry and the forwarded
> @@ -129,7 +129,7 @@ static int filter_header_do(void *v, con
> }
> static int remove_header_do(void *v, const char *key, const char *val)
> {
> - if ((*key == 'W' || *key == 'w') && !ap_casecmpstr(key, "Warning")) {
> + if ((*key == 'W' || *key == 'w') && !ap_cstr_casecmp(key, "Warning"))
> {
> /* any stored Warning headers with warn-code 2xx MUST be retained
> * in the cache entry and the forwarded response.
> */
>
> URL:
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/mappers/mod_rewrite.c?rev=1747469&r1=1747468&r2=1747469&view=diff
>
> ==============================================================================
> --- httpd/httpd/trunk/modules/mappers/mod_rewrite.c (original)
> +++ httpd/httpd/trunk/modules/mappers/mod_rewrite.c Thu Jun 9 00:06:42
> 2016
> @@ -526,7 +526,7 @@ static unsigned is_absolute_uri(char *ur
> switch (*uri++) {
> case 'a':
> case 'A':
> - if (!ap_casecmpstrn(uri, "jp://", 5)) { /* ajp:// */
> + if (!ap_cstr_casecmpn(uri, "jp://", 5)) { /* ajp:// */
> *sqs = 1;
> return 6;
> }
> @@ -534,7 +534,7 @@ static unsigned is_absolute_uri(char *ur
>
> case 'b':
> case 'B':
> - if (!ap_casecmpstrn(uri, "alancer://", 10)) { /* balancer:// */
> + if (!ap_cstr_casecmpn(uri, "alancer://", 10)) { /* balancer://
> */
> *sqs = 1;
> return 11;
> }
> @@ -542,10 +542,10 @@ static unsigned is_absolute_uri(char *ur
>
> case 'f':
> case 'F':
> - if (!ap_casecmpstrn(uri, "tp://", 5)) { /* ftp:// */
> + if (!ap_cstr_casecmpn(uri, "tp://", 5)) { /* ftp:// */
> return 6;
> }
> - if (!ap_casecmpstrn(uri, "cgi://", 6)) { /* fcgi:// */
> + if (!ap_cstr_casecmpn(uri, "cgi://", 6)) { /* fcgi:// */
> *sqs = 1;
> return 7;
> }
> @@ -553,26 +553,26 @@ static unsigned is_absolute_uri(char *ur
>
> case 'g':
> case 'G':
> - if (!ap_casecmpstrn(uri, "opher://", 8)) { /* gopher:// */
> + if (!ap_cstr_casecmpn(uri, "opher://", 8)) { /* gopher:// */
> return 9;
> }
> break;
>
> case 'h':
> case 'H':
> - if (!ap_casecmpstrn(uri, "ttp://", 6)) { /* http:// */
> + if (!ap_cstr_casecmpn(uri, "ttp://", 6)) { /* http:// */
> *sqs = 1;
> return 7;
> }
> - else if (!ap_casecmpstrn(uri, "ttps://", 7)) { /* https:// */
> + else if (!ap_cstr_casecmpn(uri, "ttps://", 7)) { /* https:// */
> *sqs = 1;
> return 8;
> }
> - else if (!ap_casecmpstrn(uri, "2://", 4)) { /* h2:// */
> + else if (!ap_cstr_casecmpn(uri, "2://", 4)) { /* h2:// */
> *sqs = 1;
> return 5;
> }
> - else if (!ap_casecmpstrn(uri, "2c://", 5)) { /* h2c:// */
> + else if (!ap_cstr_casecmpn(uri, "2c://", 5)) { /* h2c:// */
> *sqs = 1;
> return 6;
> }
> @@ -580,14 +580,14 @@ static unsigned is_absolute_uri(char *ur
>
> case 'l':
> case 'L':
> - if (!ap_casecmpstrn(uri, "dap://", 6)) { /* ldap:// */
> + if (!ap_cstr_casecmpn(uri, "dap://", 6)) { /* ldap:// */
> return 7;
> }
> break;
>
> case 'm':
> case 'M':
> - if (!ap_casecmpstrn(uri, "ailto:", 6)) { /* mailto: */
> + if (!ap_cstr_casecmpn(uri, "ailto:", 6)) { /* mailto: */
> *sqs = 1;
> return 7;
> }
> @@ -595,17 +595,17 @@ static unsigned is_absolute_uri(char *ur
>
> case 'n':
> case 'N':
> - if (!ap_casecmpstrn(uri, "ews:", 4)) { /* news: */
> + if (!ap_cstr_casecmpn(uri, "ews:", 4)) { /* news: */
> return 5;
> }
> - else if (!ap_casecmpstrn(uri, "ntp://", 6)) { /* nntp:// */
> + else if (!ap_cstr_casecmpn(uri, "ntp://", 6)) { /* nntp:// */
> return 7;
> }
> break;
>
> case 's':
> case 'S':
> - if (!ap_casecmpstrn(uri, "cgi://", 6)) { /* scgi:// */
> + if (!ap_cstr_casecmpn(uri, "cgi://", 6)) { /* scgi:// */
> *sqs = 1;
> return 7;
> }
> @@ -613,11 +613,11 @@ static unsigned is_absolute_uri(char *ur
>
> case 'w':
> case 'W':
> - if (!ap_casecmpstrn(uri, "s://", 4)) { /* ws:// */
> + if (!ap_cstr_casecmpn(uri, "s://", 4)) { /* ws:// */
> *sqs = 1;
> return 5;
> }
> - else if (!ap_casecmpstrn(uri, "ss://", 5)) { /* wss:// */
> + else if (!ap_cstr_casecmpn(uri, "ss://", 5)) { /* wss:// */
> *sqs = 1;
> return 6;
> }
>
Just a guess that the illegible code above is nonsense, in terms of
any actual performance benefit.