Return-Path: Delivered-To: apmail-httpd-cvs-archive@www.apache.org Received: (qmail 15052 invoked from network); 24 Oct 2005 12:19:21 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 24 Oct 2005 12:19:21 -0000 Received: (qmail 43832 invoked by uid 500); 24 Oct 2005 12:19:20 -0000 Delivered-To: apmail-httpd-cvs-archive@httpd.apache.org Received: (qmail 43630 invoked by uid 500); 24 Oct 2005 12:19:18 -0000 Mailing-List: contact cvs-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: dev@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list cvs@httpd.apache.org Received: (qmail 43619 invoked by uid 99); 24 Oct 2005 12:19:18 -0000 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 24 Oct 2005 05:19:18 -0700 Received: (qmail 14828 invoked by uid 65534); 24 Oct 2005 12:18:58 -0000 Message-ID: <20051024121858.14826.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r328048 - /httpd/httpd/trunk/support/logresolve.c Date: Mon, 24 Oct 2005 12:18:57 -0000 To: cvs@httpd.apache.org From: colm@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: colm Date: Mon Oct 24 05:18:54 2005 New Revision: 328048 URL: http://svn.apache.org/viewcvs?rev=328048&view=rev Log: Logresolve style and nit fix-ups: * Remove some redundant whitespace in variable declarations. * Add some whitespace for clarity around an if and a while statement. * Remove redundant and unneccessary casts * Use APR_HASH_KEY_STRING Modified: httpd/httpd/trunk/support/logresolve.c Modified: httpd/httpd/trunk/support/logresolve.c URL: http://svn.apache.org/viewcvs/httpd/httpd/trunk/support/logresolve.c?rev=328048&r1=328047&r2=328048&view=diff ============================================================================== --- httpd/httpd/trunk/support/logresolve.c (original) +++ httpd/httpd/trunk/support/logresolve.c Mon Oct 24 05:18:54 2005 @@ -126,25 +126,25 @@ int main(int argc, const char * const argv[]) { - apr_file_t * outfile; - apr_file_t * infile; - apr_file_t * statsfile; - apr_sockaddr_t * ip; - apr_sockaddr_t * ipdouble; - apr_getopt_t * o; - apr_pool_t * pool; - apr_status_t status; - const char * arg; - char opt; - char * stats = NULL; - char * space; - char * hostname; + apr_file_t * outfile; + apr_file_t * infile; + apr_file_t * statsfile; + apr_sockaddr_t * ip; + apr_sockaddr_t * ipdouble; + apr_getopt_t * o; + apr_pool_t * pool; + apr_status_t status; + const char * arg; + char opt; + char * stats = NULL; + char * space; + char * hostname; #if APR_MAJOR_VERSION > 1 || (APR_MAJOR_VERSION == 1 && APR_MINOR_VERSION >= 3) - char * inbuffer; - char * outbuffer; + char * inbuffer; + char * outbuffer; #endif - char line[2048]; - int doublelookups = 0; + char line[2048]; + int doublelookups = 0; if (apr_app_initialize(&argc, &argv, NULL) != APR_SUCCESS) { return 1; @@ -204,7 +204,7 @@ cache = apr_hash_make(pool); - while(apr_file_gets(line, 2048, infile) == APR_SUCCESS) { + while (apr_file_gets(line, 2048, infile) == APR_SUCCESS) { if (line[0] == '\0') { continue; } @@ -220,13 +220,12 @@ } /* Terminate the line at the next space */ - if((space = strchr(line, ' ')) != NULL) { + if ((space = strchr(line, ' ')) != NULL) { *space = '\0'; } /* See if we have it in our cache */ - hostname = (char *) apr_hash_get(cache, (const void *)line, - strlen(line)); + hostname = (char *) apr_hash_get(cache, line, APR_HASH_KEY_STRING); if (hostname) { apr_file_printf(outfile, "%s %s", hostname, space + 1); cachehits++; @@ -238,7 +237,7 @@ if (status != APR_SUCCESS) { /* Not an IP address */ withname++; - *space = ' '; + *space = ' '; apr_file_puts(line, outfile); continue; } @@ -264,8 +263,8 @@ /* Add to cache */ *space = '\0'; - apr_hash_set(cache, (const void *) line, strlen(line), - (const void *) apr_pstrdup(pool, line)); + apr_hash_set(cache, line, APR_HASH_KEY_STRING, + apr_pstrdup(pool, line)); continue; } @@ -285,8 +284,8 @@ /* Add to cache */ *space = '\0'; - apr_hash_set(cache, (const void *) line, strlen(line), - (const void *) apr_pstrdup(pool, line)); + apr_hash_set(cache, line, APR_HASH_KEY_STRING, + apr_pstrdup(pool, line)); continue; } } @@ -295,8 +294,8 @@ apr_file_printf(outfile, "%s %s", hostname, space + 1); /* Store it in the cache */ - apr_hash_set(cache, (const void *) line, strlen(line), - (const void *) apr_pstrdup(pool, hostname)); + apr_hash_set(cache, line, APR_HASH_KEY_STRING, + apr_pstrdup(pool, hostname)); } /* Flush any remaining output */