You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by co...@apache.org on 2005/10/24 14:18:57 UTC
svn commit: r328048 - /httpd/httpd/trunk/support/logresolve.c
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 */