diff options
author | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-05-31 23:02:21 +0000 |
---|---|---|
committer | Robert James Kaes <rjkaes@users.sourceforge.net> | 2003-05-31 23:02:21 +0000 |
commit | 77ca1c8ce0df4d7733bb5a382ca8c18adba93e1c (patch) | |
tree | 75dee7eb6b1f1de3ddbdd4104a2fdd112322f27a /src | |
parent | 86c9d6908606c7c47d305b46a242a417c0f22673 (diff) | |
download | tinyproxy-77ca1c8ce0df4d7733bb5a382ca8c18adba93e1c.tar.gz tinyproxy-77ca1c8ce0df4d7733bb5a382ca8c18adba93e1c.zip |
# Changed all the for calls to use the != test rather than < test.
The change was recommended in the C/C++ User Journal magazine.
Diffstat (limited to 'src')
-rw-r--r-- | src/child.c | 10 | ||||
-rw-r--r-- | src/conns.c | 4 | ||||
-rw-r--r-- | src/hashmap.c | 8 | ||||
-rw-r--r-- | src/htmlerror.c | 18 | ||||
-rw-r--r-- | src/http_message.c | 8 | ||||
-rw-r--r-- | src/log.c | 4 | ||||
-rw-r--r-- | src/reqs.c | 10 |
7 files changed, 31 insertions, 31 deletions
diff --git a/src/child.c b/src/child.c index cc0a16b..9726aa8 100644 --- a/src/child.c +++ b/src/child.c @@ -1,4 +1,4 @@ -/* $Id: child.c,v 1.10 2003-04-16 18:04:58 rjkaes Exp $ +/* $Id: child.c,v 1.11 2003-05-31 23:02:21 rjkaes Exp $ * * Handles the creation/destruction of the various children required for * processing incoming connections. @@ -319,12 +319,12 @@ child_pool_create(void) child_config.startservers = child_config.maxclients; } - for (i = 0; i < child_config.maxclients; i++) { + for (i = 0; i != child_config.maxclients; i++) { child_ptr[i].status = T_EMPTY; child_ptr[i].connects = 0; } - for (i = 0; i < child_config.startservers; i++) { + for (i = 0; i != child_config.startservers; i++) { DEBUG2("Trying to create child %d of %d", i + 1, child_config.startservers); child_ptr[i].status = T_WAITING; child_ptr[i].tid = child_make(&child_ptr[i]); @@ -370,7 +370,7 @@ child_main_loop(void) SERVER_COUNT_UNLOCK(); - for (i = 0; i < child_config.maxclients; i++) { + for (i = 0; i != child_config.maxclients; i++) { if (child_ptr[i].status == T_EMPTY) { child_ptr[i].status = T_WAITING; child_ptr[i].tid = child_make(&child_ptr[i]); @@ -418,7 +418,7 @@ child_kill_children(void) { int i; - for (i = 0; i < child_config.maxclients; i++) { + for (i = 0; i != child_config.maxclients; i++) { if (child_ptr[i].status != T_EMPTY) kill(child_ptr[i].tid, SIGTERM); } diff --git a/src/conns.c b/src/conns.c index 6015eff..1de8f40 100644 --- a/src/conns.c +++ b/src/conns.c @@ -1,4 +1,4 @@ -/* $Id: conns.c,v 1.16 2003-05-04 04:35:10 rjkaes Exp $ +/* $Id: conns.c,v 1.17 2003-05-31 23:02:21 rjkaes Exp $ * * Create and free the connection structure. One day there could be * other connection related tasks put here, but for now the header @@ -116,7 +116,7 @@ destroy_conn(struct conn_s *connptr) if (connptr->error_variables) { int i; - for (i = 0; i < connptr->error_variable_count; ++i) { + for (i = 0; i != connptr->error_variable_count; ++i) { safefree(connptr->error_variables[i]->error_key); safefree(connptr->error_variables[i]->error_val); safefree(connptr->error_variables[i]); diff --git a/src/hashmap.c b/src/hashmap.c index c7aa3a5..4f7773d 100644 --- a/src/hashmap.c +++ b/src/hashmap.c @@ -1,4 +1,4 @@ -/* $Id: hashmap.c,v 1.11 2002-05-24 04:45:32 rjkaes Exp $ +/* $Id: hashmap.c,v 1.12 2003-05-31 23:02:21 rjkaes Exp $ * * A hashmap implementation. The keys are case-insensitive NULL terminated * strings, and the data is arbitrary lumps of data. Copies of both the @@ -158,7 +158,7 @@ hashmap_delete(hashmap_t map) if (map == NULL) return -EINVAL; - for (i = 0; i < map->size; i++) { + for (i = 0; i != map->size; i++) { if (map->buckets[i] != NULL) { delete_hashbucket(map->buckets[i]); map->buckets[i] = NULL; @@ -313,7 +313,7 @@ hashmap_find(hashmap_t map, const char* key) * Loop through all the keys and look for the first occurrence * of a particular key. */ - for (i = 0; i < map->size; i++) { + for (i = 0; i != map->size; i++) { ptr = map->buckets[i]; while (ptr) { @@ -353,7 +353,7 @@ hashmap_return_entry(hashmap_t map, hashmap_iter iter, if (!map || iter < 0 || !key || !data) return -EINVAL; - for (i = 0; i < map->size; i++) { + for (i = 0; i != map->size; i++) { ptr = map->buckets[i]; while (ptr) { if (count == iter) { diff --git a/src/htmlerror.c b/src/htmlerror.c index 008ac2f..c0eeb86 100644 --- a/src/htmlerror.c +++ b/src/htmlerror.c @@ -1,4 +1,4 @@ -/* $Id: htmlerror.c,v 1.4 2003-04-01 16:41:33 rjkaes Exp $ +/* $Id: htmlerror.c,v 1.5 2003-05-31 23:02:21 rjkaes Exp $ * * This file contains source code for the handling and display of * HTML error pages with variable substitution. @@ -64,11 +64,11 @@ static char* get_html_file(int errornum) { int i; - if(!config.errorpages) return(config.errorpage_undef); + if (!config.errorpages) return(config.errorpage_undef); - for(i = 0; config.errorpages[i]; i++) { - if(config.errorpages[i]->errorpage_errnum == errornum) - return(config.errorpages[i]->errorpage_path); + for (i = 0; config.errorpages[i]; i++) { + if (config.errorpages[i]->errorpage_errnum == errornum) + return config.errorpages[i]->errorpage_path; } return(config.errorpage_undef); @@ -81,9 +81,9 @@ static char* lookup_variable(struct conn_s *connptr, char *varname) { int i; - for(i = 0; i<connptr->error_variable_count; i++) { - if(!strcasecmp(connptr->error_variables[i]->error_key, varname)) - return(connptr->error_variables[i]->error_val); + for (i = 0; i != connptr->error_variable_count; i++) { + if (!strcasecmp(connptr->error_variables[i]->error_key, varname)) + return connptr->error_variables[i]->error_val; } return(NULL); @@ -101,7 +101,7 @@ send_html_file(FILE *infile, struct conn_s *connptr) { int in_variable = 0, writeret; while(fgets(inbuf, HTML_BUFSIZE, infile) != NULL) { - for(p = inbuf; *p; p++) { + for (p = inbuf; *p; p++) { switch(*p) { case '}': if(in_variable) { diff --git a/src/http_message.c b/src/http_message.c index 6f19db9..31ab03e 100644 --- a/src/http_message.c +++ b/src/http_message.c @@ -1,4 +1,4 @@ -/* $Id: http_message.c,v 1.1 2003-03-13 05:25:30 rjkaes Exp $ +/* $Id: http_message.c,v 1.2 2003-05-31 23:02:21 rjkaes Exp $ * * See 'http_message.h' for a detailed description. * @@ -188,7 +188,7 @@ http_message_add_headers(http_message_t msg, char** headers, return -ENOMEM; /* Copy the array */ - for (i = 0; i < msg->headers.used; ++i) + for (i = 0; i != msg->headers.used; ++i) new_headers[i] = msg->headers.strings[i]; /* Remove the old array and replace it with the new array */ @@ -200,7 +200,7 @@ http_message_add_headers(http_message_t msg, char** headers, /* * Add the new headers to the structure */ - for (i = 0; i < num_headers; ++i) + for (i = 0; i != num_headers; ++i) msg->headers.strings[i + msg->headers.used] = headers[i]; msg->headers.used += num_headers; @@ -229,7 +229,7 @@ http_message_send(http_message_t msg, int fd) msg->response.code, msg->response.string); /* Go through all the headers */ - for (i = 0; i < msg->headers.used; ++i) + for (i = 0; i != msg->headers.used; ++i) write_message(fd, "%s\r\n", msg->headers.strings[i]); /* Output the date */ @@ -1,4 +1,4 @@ -/* $Id: log.c,v 1.25 2003-05-30 16:22:30 rjkaes Exp $ +/* $Id: log.c,v 1.26 2003-05-31 23:02:21 rjkaes Exp $ * * Logs the various messages which tinyproxy produces to either a log file or * the syslog daemon. Not much to it... @@ -201,7 +201,7 @@ send_stored_logs(void) int i; - for (i = 0; i < vector_length(log_message_storage); ++i) { + for (i = 0; i != vector_length(log_message_storage); ++i) { string = vector_getentry(log_message_storage, i, NULL); ptr = strchr(string, ' ') + 1; @@ -1,4 +1,4 @@ -/* $Id: reqs.c,v 1.100 2003-05-30 16:22:30 rjkaes Exp $ +/* $Id: reqs.c,v 1.101 2003-05-31 23:02:20 rjkaes Exp $ * * This is where all the work in tinyproxy is actually done. Incoming * connections have a new child created for them. The child then @@ -127,7 +127,7 @@ check_allowed_connect_ports(int port) if (!ports_allowed_by_connect) return 1; - for (i = 0; i < vector_length(ports_allowed_by_connect); ++i) { + for (i = 0; i != vector_length(ports_allowed_by_connect); ++i) { data = vector_getentry(ports_allowed_by_connect, i, NULL); if (!data) return -1; @@ -905,7 +905,7 @@ remove_connection_headers(hashmap_t hashofheaders) ssize_t len; int i; - for (i = 0; i < (sizeof(headers) / sizeof(char *)); ++i) { + for (i = 0; i != (sizeof(headers) / sizeof(char *)); ++i) { /* Look for the connection header. If it's not found, return. */ len = hashmap_entry_by_key(hashofheaders, headers[i], (void **)&data); if (len <= 0) @@ -1056,7 +1056,7 @@ process_client_headers(struct conn_s *connptr, hashmap_t hashofheaders) /* * Delete the headers listed in the skipheaders list */ - for (i = 0; i < (sizeof(skipheaders) / sizeof(char *)); i++) { + for (i = 0; i != (sizeof(skipheaders) / sizeof(char *)); i++) { hashmap_remove(hashofheaders, skipheaders[i]); } @@ -1206,7 +1206,7 @@ process_server_headers(struct conn_s *connptr) /* * Delete the headers listed in the skipheaders list */ - for (i = 0; i < (sizeof(skipheaders) / sizeof(char *)); i++) { + for (i = 0; i != (sizeof(skipheaders) / sizeof(char *)); i++) { hashmap_remove(hashofheaders, skipheaders[i]); } |